[英]A finite possibly non-deterministic state machine with dwell durations
after posting a somewhat ambiguous question , I believe I have nailed that what I am wondering (I am a complete novice in FSMs).在发布了一个有点模棱两可的问题之后,我相信我已经确定了我的疑惑(我是 FSM 的完全新手)。
I would like to simulate a state space using finite state machines (possibly non-deterministic automata ie multiple next-state transitions allowed) in clojure.我想在 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.假设我们有这些状态
Q={flying,cycling,running,driving}
并且我们有平均一天中每个状态的持续时间D={120,30,30,60}
- 为了论证,这些以分钟为单位. How can one then create a possibly non-deterministic FSM (multiple destination states allowed) using clojure?那么如何使用 clojure 创建一个可能的非确定性 FSM(允许多个目标状态)? I have looked at eg https://github.com/cdorrat/reduce-fsm and https://github.com/ztellman/automat but I do not believe it is quite what I want.
我看过例如https://github.com/cdorrat/reduce-fsm和https://github.com/ztellman/automat但我不相信这正是我想要的。
My end goal is to get a simulation looking something like S = {flying,flying,flying,flying,flying,cycling,cycling,running,driving,driving,driving}
.我的最终目标是让模拟看起来像
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.
结束和开始状态并不重要。
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.
我认为如果这是出于编程目的,建议您使用UML中的状态机图。 They are powerful enough for your problem.
它们足以解决您的问题。
I would recommend:我会推荐:
Here is an example of such an approach for ants simulation Ant FSM这是蚂蚁模拟Ant FSM这种方法的一个例子
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.