MESIN MOORE FSA Finite State Automata yang telah

  • Slides: 39
Download presentation

MESIN MOORE • FSA (Finite State Automata) yang telah dipelajari adalah FSA yang hanya

MESIN MOORE • FSA (Finite State Automata) yang telah dipelajari adalah FSA yang hanya dapat menerima atau menolak string yang di inputkan • String “aaabb” diterima atau tidak

MESIN MOORE A a B a b a D C • String aa dan

MESIN MOORE A a B a b a D C • String aa dan ba diterima oleh FSA tersebut, sedangkan string yang lain ditolak

MESIN MOORE • FSA (Finite State Automata) yang mempunyai keputusan sebagai output, Automata ini

MESIN MOORE • FSA (Finite State Automata) yang mempunyai keputusan sebagai output, Automata ini disebut TRANSDUCER • Salah satu contoh FSA yang termasuk Transducer atau FSA yang mempunyai output adalah

MESIN MOORE • Pada Mesin Moore outputnya berasosiasi dengan state, atau tertulis pada setiap

MESIN MOORE • Pada Mesin Moore outputnya berasosiasi dengan state, atau tertulis pada setiap state • Sehingga Jumlah State sama dengan jumlah Output

MESIN MOORE M={Q, , , S, , } Q : Himpunan State : Himpunan

MESIN MOORE M={Q, , , S, , } Q : Himpunan State : Himpunan Input : Fungsi Transisi S : Simbol State Awal : Himpunan Output : Fungsi Output untuk setiap state Komponen final state dari DFA dihilangkan, karena disini keputusan dimunculkan sebagai output

MESIN MOORE • Salah satu contoh penerapan mesin Moore adalah mesin untuk memperoleh sisa

MESIN MOORE • Salah satu contoh penerapan mesin Moore adalah mesin untuk memperoleh sisa pembagian atau n MOD m • Contoh : Mesin Moore untuk menentukan n mod 2 dengan inputan berupa biner

N MOD 2 MESIN MOORE • n mod 2 diinisialisasikan n mod m, jadi

N MOD 2 MESIN MOORE • n mod 2 diinisialisasikan n mod m, jadi m = 2 • Isi kolom desimal dengan ketentuan m x 2 = 2 x 2 = 4, jadi ada 4 desimal dan dimulai dari 0 Desimal 0 1 2 3 Desimal Modulo 2 Output State Biner 8421 Transisi

N MOD 2 MESIN MOORE • Isi kolom desimal modulo m atau desimal modulo

N MOD 2 MESIN MOORE • Isi kolom desimal modulo m atau desimal modulo 2 Desimal Modulo 2 0 0 1 1 2 0 3 1 Output State Biner 8421 Transisi

N MOD 2 MESIN MOORE • Isi kolom output state secara berurutan dan bergantian,

N MOD 2 MESIN MOORE • Isi kolom output state secara berurutan dan bergantian, bisa A B atau q 0 q 1 (tergantung hasil jenis desimal modulo 2) Desimal Modulo 2 Output State 0 0 q 0 1 1 q 1 2 0 q 0 3 1 q 1 Biner 8421 Transisi

N MOD 2 MESIN MOORE • Isi kolom biner dengan konversi kolom desimal ke

N MOD 2 MESIN MOORE • Isi kolom biner dengan konversi kolom desimal ke biner Desimal Modulo 2 Output State Biner 8421 0 0 q 0 0000 1 1 q 1 0001 2 0 q 0 0010 3 1 q 1 0011 Transisi

N MOD 2 MESIN MOORE • Isi kolom transisi • Karena desimal ada 4

N MOD 2 MESIN MOORE • Isi kolom transisi • Karena desimal ada 4 dan ouput ada 2, maka dibagi 2 bagian Desimal Modulo 2 Output State Biner 8421 Transisi 0 0 q 0 0000 (q 0, 0) = q 0 1 1 q 1 0001 2 0 q 0 0010 q 0 (q 1, 0) = q 0 q 1 3 1 q 1 0011 (q 0, 1) = q 1 (q 1, 1) = q 1

N MOD 2 MESIN MOORE Sehingga didapat : M={Q, , , S, , }

N MOD 2 MESIN MOORE Sehingga didapat : M={Q, , , S, , } Q = {q 0, q 1} kolom ouput state = {0, 1} input berupa biner, maka 0 1 = (q 0, 0)=q 0, (q 0, 1)=q 1, (q 1, 0)=q 0, (q 1, 1)=q 1 kolom transisi S = q 0 kolom output state yang pertama = {0, 1} kolom hasil modulo m = (q 0) = 0, (q 1) = 1 kolom hasil modulo m dan output state

N MOD 2 MESIN MOORE = (q 0, 0)=q 0, (q 0, 1)=q 1,

N MOD 2 MESIN MOORE = (q 0, 0)=q 0, (q 0, 1)=q 1, (q 1, 0)=q 0, (q 1, 1)=q 1 kolom transisi = (q 0) = 0, (q 1) = 1 kolom hasil modulo m dan output state 0 1 q 0/0 1 q 1/1 0

N MOD 2 MESIN MOORE Test : 7 Mod 2 = 1 7 binernya

N MOD 2 MESIN MOORE Test : 7 Mod 2 = 1 7 binernya 0111 (q 0, 0111) = (q 0, 111) = (q 1, 1) = q 1 =1 0 1 q 0/0 1 q 1/1 0

N MOD 2 MESIN MOORE Test : 10 Mod 2 = 0 10 binernya

N MOD 2 MESIN MOORE Test : 10 Mod 2 = 0 10 binernya 1010 (q 0, 1010) = (q 1, 010) = (q 0, 10) = (q 1, 0) = q 0 =0 0 1 q 0/0 1 q 1/1 0

MESIN MOORE • Contoh 2 : Buatlah mesin Moore untuk menentukan n mod 3

MESIN MOORE • Contoh 2 : Buatlah mesin Moore untuk menentukan n mod 3

N MOD 3 MESIN MOORE • n mod 3 diinisialisasikan n mod m, jadi

N MOD 3 MESIN MOORE • n mod 3 diinisialisasikan n mod m, jadi m = 3 • Isi kolom desimal dengan ketentuan m x 2 = 3 x 2 = 6, jadi ada 6 desimal dan dimulai dari 0 Desimal 0 1 2 3 4 5 Desimal Modulo 2 Output State Biner 8421 Transisi

N MOD 3 MESIN MOORE • Isi kolom desimal modulo m atau desimal modulo

N MOD 3 MESIN MOORE • Isi kolom desimal modulo m atau desimal modulo 3 Desimal 0 1 Desimal Modulo 3 0 1 2 3 4 5 2 0 1 2 Output State Biner 8421 Transisi

N MOD 3 MESIN MOORE • Isi kolom output state secara berurutan dan bergantian,

N MOD 3 MESIN MOORE • Isi kolom output state secara berurutan dan bergantian, bisa A B C atau q 0 q 1 q 3 (tergantung hasil jenis desimal modulo 3) Desimal 0 1 Desimal Modulo 3 0 1 Output State q 0 q 1 2 3 4 5 2 0 1 2 q 0 q 1 q 2 Biner 8421 Transisi

N MOD 3 MESIN MOORE • Isi kolom biner dengan konversi kolom desimal ke

N MOD 3 MESIN MOORE • Isi kolom biner dengan konversi kolom desimal ke biner Desimal 0 1 Desimal Modulo 3 0 1 Output State q 0 q 1 Biner 8421 0000 0001 2 3 4 5 2 0 1 2 q 0 q 1 q 2 0010 0011 0100 0101 Transisi

N MOD 3 MESIN MOORE • Isi kolom transisi • Karena desimal ada 6

N MOD 3 MESIN MOORE • Isi kolom transisi • Karena desimal ada 6 dan ouput ada 3, maka dibagi 2 bagian Desimal 0 1 Desimal Modulo 3 0 1 Output State q 0 q 1 2 3 4 5 2 0 1 2 q 0 q 1 q 2 Biner Transisi 8421 0000 (q 0, 0) = q 0 0001 (q 0, 1) = q 1 0010 (q 1, 0) = q 2 q 1 0011 (q 1, 1) = q 0 0100 (q 2, 0) = q 1 q 2 0101 (q 2, 1) = q 2

N MOD 3 MESIN MOORE Sehingga didapat : M={Q, , , S, , }

N MOD 3 MESIN MOORE Sehingga didapat : M={Q, , , S, , } Q = {q 0, q 1, q 2} kolom ouput state = {0, 1} input berupa biner, maka 0 1 = (q 0, 0)=q 0, (q 0, 1)=q 1, (q 1, 0)=q 2, (q 1, 1)=q 0, (q 2, 0)=q 1, (q 2, 1)=q 2 kolom transisi S = q 0 kolom output state yang pertama = {0, 1, 2} kolom hasil modulo m = (q 0) = 0, (q 1) = 1 (q 2) = 2 kolom hasil modulo m dan output state

N MOD 3 MESIN MOORE = (q 0, 0)=q 0, (q 0, 1)=q 1,

N MOD 3 MESIN MOORE = (q 0, 0)=q 0, (q 0, 1)=q 1, (q 1, 0)=q 2, (q 1, 1)=q 0, (q 2, 0)=q 1, (q 2, 1)=q 2 kolom transisi = (q 0) = 0, (q 1) = 1, (q 2) = 2 kolom hasil modulo m dan output state

N MOD 3 MESIN MOORE Test : 12 Mod 3 = 0 12 binernya

N MOD 3 MESIN MOORE Test : 12 Mod 3 = 0 12 binernya 1100 (q 0, 1100) = (q 1, 100) = (q 0, 0) = q 0 = 0

N MOD 3 MESIN MOORE Test : 14 Mod 3 = 2 14 binernya

N MOD 3 MESIN MOORE Test : 14 Mod 3 = 2 14 binernya 1110 (q 0, 1110) = (q 1, 110) = (q 0, 10) = (q 1, 0) = q 2 = 2

MESIN MOORE • Tugas : Buatlah mesin Moore untuk menentukan n mod 4 dan

MESIN MOORE • Tugas : Buatlah mesin Moore untuk menentukan n mod 4 dan n mod 5 Tulis tabel, rumus M, dan FSA, lalu cek 2 x serta eqivalensi ke mesin Mealy Kerjakan sendiri!

MESIN MEALY • Mesin Mealy 6 tupel, yaitu : • M={Q, , , S,

MESIN MEALY • Mesin Mealy 6 tupel, yaitu : • M={Q, , , S, , } Q : Himpunan State : Himpunan Simbol Input : Fungsi Transisi S : Simbol State Awal : Himpunan Output : Fungsi Output untuk setiap transisi

MESIN MEALY • Pada Mesin Moore Output berasosiasi dengan State, tetapi pada Mesin Mealy

MESIN MEALY • Pada Mesin Moore Output berasosiasi dengan State, tetapi pada Mesin Mealy output berasosiasi dengan transisi, sehingga dalam fungsi output : (State, Input)=Output • Tidak ada aturan yang jelas dalam membentuk graph transisinya

EQI MESIN MOORE KE MEALY • Eqivalensi mesin Moore ke mesin Mealy adalah merubah

EQI MESIN MOORE KE MEALY • Eqivalensi mesin Moore ke mesin Mealy adalah merubah mesin Moore menjadi mesin Mealy dengan kemampuan yang sama • Caranya : 1. menghapus label Output pada setiap state 2. menambahkan label Output pada

EQI MESIN MOORE KE MEALY Moore Mealy 1 1/1 q 1/1 (q 1)=1 (q

EQI MESIN MOORE KE MEALY Moore Mealy 1 1/1 q 1/1 (q 1)=1 (q 1, 1)=q 1 (q 1, 1)=1 FO FT (q 1, 1)=q 1

EQI MESIN MOORE KE MEALY Moore q 1/ 0 1 Mealy q 0 q

EQI MESIN MOORE KE MEALY Moore q 1/ 0 1 Mealy q 0 q 1/ 1 (q 0)=0, (q 1)=1 (q 0, 1)=q 1 1/1 q 1 (q 0, 1)=1 (q 0, 1)=q 1

N MOD 2 EQI MESIN MOORE KE MEALY Contoh : Diketahui Mesin Moore n

N MOD 2 EQI MESIN MOORE KE MEALY Contoh : Diketahui Mesin Moore n Mod 2, 0 1 q 0/0 1 q 1/1 0 Buat mesin Mealy yang eqivalen

N MOD 2 EQI MESIN MOORE KE MEALY Dari graph transisi ini 0 1

N MOD 2 EQI MESIN MOORE KE MEALY Dari graph transisi ini 0 1 1 q 0/0 q 1/1 0 Diketahui : (q 0, 0)=0 (q 0, 1)=1 (q 1, 0)=0 (q 1, 1)=1 Mesin Mealy yang Eqivalen 0/0 1/1 q 1 0/0

N MOD 3 EQI MESIN MOORE KE MEALY Contoh : Diketahui Mesin Moore n

N MOD 3 EQI MESIN MOORE KE MEALY Contoh : Diketahui Mesin Moore n Mod 3, Buat mesin Mealy yang eqivalen

N MOD 3 EQI MESIN MOORE KE MEALY Dari graph transisi ini Diketahui :

N MOD 3 EQI MESIN MOORE KE MEALY Dari graph transisi ini Diketahui : (q 0, 0)=0, (q 0, 1)=1, (q 1, 0)=2, (q 1, 1)=0 , (q 2, 0)=1, (q 2, 1)=2 0/0 0/2 1/1 Mesin Mealy yang Eqivalen q 0 q 1 1/0 1/2 q 2 0/1

PERBANDINGAN Mesin Moore Mesin Mealy Setiap dinyatakan sebagai nilai output Setiap transisi dinyatakan sebagai

PERBANDINGAN Mesin Moore Mesin Mealy Setiap dinyatakan sebagai nilai output Setiap transisi dinyatakan sebagai nilai output Output berubah pada suatu siklus Perubahan input dapat langsung merubah output(mesin menjadi tidak sinkron) Memerlukan beberapa logika pada state untuk menjadi output Bereaksi lebih cepat pada input