问题
after posting a somewhat ambiguous question, I believe I have nailed that what I am wondering (I am a complete novice in FSMs).
I would like to simulate a state space using finite state machines (possibly non-deterministic automata i.e. multiple next-state transitions allowed) in clojure.
This is essentially my problem:
Suppose we have these states Q={flying,cycling,running,driving}
and we have the state durations for each during an average day D={120,30,30,60}
- where for the sake of argument those are in minutes. How can one then create a possibly non-deterministic FSM (multiple destination states allowed) using clojure? I have looked at e.g. https://github.com/cdorrat/reduce-fsm and https://github.com/ztellman/automat but I do not believe it is quite what I want.
My end goal is to get a simulation looking something like S = {flying,flying,flying,flying,flying,cycling,cycling,running,driving,driving,driving}
.
Effectively inducing heavy self-transition bias in the state machine. End and start state are not important.
回答1:
The problem is not completely formulated to be answered unequivocally. Anyway: If you just want to recognize a specific sequence of states, you can use a finite automaton, and you will have to write them in that order, like:
flying -> flying -> flying -> flying -> flying -> cycling -> cycling -> running -> driving -> driving -> driving
where I'm considering that the transitions are caused by the durations you refer.
However, I suspect that you possibly need something more elaborated. That, can not be elaborated here. In my opinion if this is for programming purposes, I suggest that you use state machine diagrams from UML. They are powerful enough for your problem.
来源:https://stackoverflow.com/questions/35443709/a-finite-possibly-non-deterministic-state-machine-with-dwell-durations