开发者

Can a finite state machine transition to a previous state?

开发者 https://www.devze.com 2022-12-13 10:06 出处:网络
I know that a FSM can transition to the next state and even to the current state, i.e. a state that transitions to itself, but is it legal to have a state transition to a previo开发者_StackOverflowus

I know that a FSM can transition to the next state and even to the current state, i.e. a state that transitions to itself, but is it legal to have a state transition to a previo开发者_StackOverflowus state (state C transition to state B)?


Yes, many practical FSMs will in fact do this. Consider an FSM that identifies valid strings of number separated by one or more spaces. This would start in the "digit" state and at some point transition to the "space" state from which it might well transition back to the "digit" state.


The "next state" of an FSM is defined as the state the machine will transition to in the next "time slice" or when the next input arrives, or whatever.

Thus defined, the next state of C can be C itself, B, A, D, ZORG or whatever state you have in the machine. Alphabetical letters don't define what's previous and what's next, only the logical flow of the FSM.

This state machine from the Wikipedia page:

Can a finite state machine transition to a previous state?


http://en.wikipedia.org/wiki/File:Finite_state_machine_example_with_comments.svg

0

精彩评论

暂无评论...
验证码 换一张
取 消