简体   繁体   English

如何为“常规”function 创建确定性有限自动机,其中状态导致多个 state,具体取决于 int 的值

[英]How to create a deterministic finite automata for the "regular" function where states lead to more than one state depending on the value of an int

the manual of Minizinc says that we can pass an array to the "regular" function that represent the transitions between states of a DFA. Minizinc 的手册说我们可以将一个数组传递给“常规”function,它表示 DFA 状态之间的转换。 For this state machine:对于这台 state 机器:

在此处输入图像描述 It puts this example:它把这个例子:

array[STATE,SHIFT] of int: t =
 [| 2, 3, 1    % state 1
  | 4, 4, 1    % state 2
  | 4, 5, 1    % state 3
  | 6, 6, 1    % state 4
  | 6, 0, 1    % state 5
  | 0, 0, 1|]; % state 6 

Where the row indicates the state, the first two rows indicate the value of "d" and "n", and the last one is the state that it leads to.其中行表示state,前两行表示“d”和“n”的值,最后一行是它引出的state。 However, it doesn't have any examples of how to aproach it if we need to make a state machine where the state can lead to more than one states, or where the variables of excitation aren't boolean. For instance:但是,它没有任何示例说明如果我们需要制造一台 state 机器,其中 state 可以导致多个状态,或者激励变量不是 boolean。例如: 在此处输入图像描述

I can't find it in the manual or in Google, thanks.我无法在手册或谷歌中找到它,谢谢。

I am not familiar with Minizinc, but your first question does not depend on that: You are dealing with a deterministic automaton, so each input value can only lead to one other state, otherwise it would be non-deterministic.我不熟悉 Minizinc,但你的第一个问题并不依赖于此:你正在处理一个确定性自动机,因此每个输入值只能导致另一个state,否则它将是不确定的。

As to your second question, if the possible values for x are restricted to 0, 1, 2, and 3, then you could re-phrase this as booleans: in analogy to the d/n/o example, the first column would give the state for x = 0, the second one for x = 1, etc. This does become unwieldy when x can have many values, but should work for your example.至于你的第二个问题,如果x的可能值被限制为 0、1、2 和 3,那么你可以将其重新表述为布尔值:类似于 d/n/o 示例,第一列将给出x = 0 的 state,x = 1 的第二个,等等。当x可以有很多值时,这确实变得笨拙,但应该适用于您的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM