fsm


about states of finite state machine


the question is let sigma =(1,2,3,$). I need to draw its diagram which outputs 1 when sum is >_5. if it is over 5, the amount will be carried over.
Im wondering what would be the state in this case. Can I let A = ive seen 1 B=ive seen 2, C=ive see 3 and D = accepted state?
No, you cannot use just three states. Your FSM must, somehow, keep counting the current sum of the input values so far. The problem is that a FSM has no memory (that would be another kind of automata) so it has to be one state for every possible combination of numbers that evaluate to all possible sums.
That is: you need a state that means ("the current sum is 0").Let that state be state 0. That would be your initial state. Other states would be "the current sum is 1" (state 1), "the current sum is 2" (state 2), .... , "the current sum is 5" (state 5), "the current sum is 6" (state 6), etc (no, you won't need an inifinite number of states, as for example, from state 5, a transition with value 1 leads you again to the state 1.
From state 0, a transition with 1 leads you to state 1. Transition with 2, to state 2 and transition with 3 to state 3. Easy, isn't it?
From state 3, for example, a transition with 1 leads you to transition 4, Transition with 2 to state 5, which is an accept state, and transition with 3 to state 6, which is also an accepted state.
To put another example: from state 6, a transition with 1 leads you to... state 2. That's right: state 6 means that the current sum is 6, which exceeds 5 in 1. So this is like transition 1, but it is an accepted state, so transitions from state 6 go to the same places as transitions from state 1 would go. This will help you building your FSM.
In fact, the larger state number is determined by the largest value you can sum with 1,2 and 3 that overflows 5 for the first time. That would be 1+1+1+1+3 = 7. So you need to define from state 0 to state 7, and of course, a final state when $ is detected.
You don't need to keep track of the current sum. You just need to keep track of the total sum modulo 5.
One way of doing this is to let your state space be A0, A1, A2, A3, A4, and B0, B1, B2. If you enter an "A" state, you output 0, and if you enter a "B" state, you output 1.
Your state transitions depend on the next digit that you see. For example:
If you are in A1, and the next digit you see is 2, you transition to A3, and output 0.
If you are in A4, and the next digit you see is 1, you transition to B0, and output 1.
If you are in B2, and the next digit you see is 1, you enter A3, and output 0.
If you are in B2, and the next digit you see is 3, you enter B0, and output 1.
In general, suppose you are in state XY, where X is either A or B, and Y is 0, 1, 2, 3, or 4. Let D be the next digit you see. The next state you will enter will be X'Y', where:
X' is A if D + Y < 5.
X' is B if D + Y >= 5.
Y' is D + Y modulo 5.

Related Links

What is the DEF state in the Ragel (6.10) document illustrations
Converting a system model into transition system for model checking
Programming a bubblesort in NuSMV
about states of finite state machine
Controlling finite-state machines
What are steps for generating fsm code in C or C++ with NunniFsm?
Compile Finite State Machine to UML(-like) Diagram
JountJS - Creating FSM Dynamically through PHP
Large DFA examples?
implementation of an Moore Automaton in digital electronics
Finite State Machine of concurrent system
Syntax for Describing DFA or NFA
Combined states, FSM
How to Build finite state machine that show modulus 4 in binary
FSM data structure design

Categories

HOME
cakephp
testing
ionic-framework
client
gitlab
openmp
webpack
read-eval-print-loop
android-4.4-kitkat
kalman-filter
analysis
paw-app
rdf
packages
ezpublish
contact
amazon-cloudformation
row
postgres-xl
lombok
highlight.js
contextmenu
crystal-reports-2008
alpine
visual-composer
conemu
telerik-reporting
php-openssl
firebase-crash-reporting
rundeck
chromebook
rst2pdf
file-rename
lightswitch-2013
phonegap
semantic-versioning
oracle-fusion-middleware
siesta-swift
protovis
accelerate-framework
y86
sequential
hexo
ios5
vxworks
jquery-bootgrid
swift3.0.2
code-search-engine
gzipstream
dynamic-reports
quadratic-programming
google-closure
arena-simulation
turbogears
http-redirect
netcdf4
scorm
skeleton-css-boilerplate
apache-fop
zip4j
jquery-validate
promela
celery-task
hls.js
powercli
flutterwave
arrow-keys
vtigercrm
vmware-tools
fuzzy-search
markojs
captivenetwork
php-internals
unity-networking
kendonumerictextbox
spidermonkey
createprocessasuser
dundas
system.reflection
angularjs-ng-click
php-5.4
jubula
htmlcleaner
datagridviewcolumn
mysqltuner
quartz-graphics
bulkloader
excel-2003
eventual-consistency
pushbackinputstream
android-screen-support
ember-app-kit
flashvars
dmoz
word-processor
venn-diagram
windows-phone-7.1.1
whoosh
fireworks
coercion
psi
xmlspy
propagation
sudzc
blitz++
vc90
nintendo-ds

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App