state-machine

Finite automaton in Haskell

北城以北 提交于 2019-12-02 19:17:26
What is a good way to represent finite automaton in Haskell? How would the data type of it look like? In our college, automata were defined as a 5-tuple (Q, X, delta, q_0, F) where Q is the set of automaton's states, X is the alphabet (is this part even necessery), delta is the transition function taking 2-tuple from (Q,X) and returning state/-s (in non-deterministic version) and F is the set of accepting/end states. Most importantly, I'm not sure what type delta should have... There are two basic options: An explicit function delta :: Q -> X -> Q (or [Q] as appropriate) as Sven Hager suggests

What are some strategies for testing large state machines?

╄→尐↘猪︶ㄣ 提交于 2019-12-02 19:17:26
I inherited a large and fairly complex state machine. It has 31 possible states, all are really needed (big business process). It has the following inputs: Enum: Current State (so 0 -> 30) Enum: source (currently only 2 entries) Boolean: Request Boolean: Type Enum: Status (3 states) Enum: Handling (3 states) Boolean: Completed Breaking it into separate state machines doesn't seem feasible, as each state is distinct. I wrote tests for the most common inputs, with one test per input, all inputs constant, except for the State. [Subject("Application Process States")] public class When_state_is

Basic State Machine setup using Stateless

拈花ヽ惹草 提交于 2019-12-02 19:10:36
I have some fairly simple state needs (for now). I think I would like to model these using the Stateless api. (But I don't really know much about state machines, so I could be wrong.) But I am getting caught up in the terminology (Specifically State and Trigger ) Here is an example: I have an order class. It is setup with several states. They are: New, Filled, Shipping, Completed, Cancelled. A few simple state rules I would like is that these state transitions are allowed: New (is the default) New -> Filled New -> Cancelled Filled -> Shipping Filled -> Cancelled Filled -> Shipping Shipping ->

How useful is Turing completeness? are neural nets turing complete?

时光毁灭记忆、已成空白 提交于 2019-12-02 16:42:55
While reading some papers about the Turing completeness of recurrent neural nets (for example: Turing computability with neural nets, Hava T. Siegelmann and Eduardo D. Sontag, 1991), I got the feeling that the proof which was given there was not really that practical. For example the referenced paper needs a neural network which neuron activity must be of infinity exactness (to reliable represent any rational number). Other proofs need a neural network of infinite size. Clearly, that is not really that practical. But I started to wonder now if it does make sense at all to ask for Turing

State machines in C

限于喜欢 提交于 2019-12-02 16:38:49
What is the best way to write a state machine in C? I usually write a big switch-case statement in a for(;;), with callbacks to re-enter the state machine when an external operation is finished. Do you know a more efficient way? I like the Quantum Leaps approach. The current state is a pointer to a function that takes an event object as argument. When an event happens, just call the state function with that event; The function can then do its work and transition to another state by just setting the state to another function. E.g.: // State type and variable, notice that it's a function pointer

Comparison between Stateless (on google code) and Windows Workflow [closed]

六眼飞鱼酱① 提交于 2019-12-02 16:37:45
I'm starting to think that I should ditch Windows WF in favor of something simpler. I don't necessarily need to pause workflow execution for extended periods of time and restore them later. I would like a simple state machine framework that does have basic suspend / resume / abort (without serialization), however. I've downloaded the Stateless framework from Google Code and am going to start playing with it, but would love to hear what the other .NET programmers out there are using. EDIT Stateless seems really simple to implement, but I do wonder if it's the right thing for a candy machine. In

Code Golf: Finite-state machine!

允我心安 提交于 2019-12-02 14:30:04
Finite state machine A deterministic finite state machine is a simple computation model, widely used as an introduction to automata theory in basic CS courses. It is a simple model, equivalent to regular expression, which determines of a certain input string is Accepted or Rejected . Leaving some formalities aside , A run of a finite state machine is composed of: alphabet , a set of characters. states , usually visualized as circles. One of the states must be the start state . Some of the states might be accepting , usually visualized as double circles. transitions , usually visualized as

Sketch that responds to certain commands, how is it done?

若如初见. 提交于 2019-12-02 07:50:10
Alright I have a half complete Arduino sketch at the moment. Basically the sketch below will blink an LED on a kegboard-mini shield if a string of chars equals *{blink_Flow_A}* However the LED only blinks once with the current sketch loaded on the Arduino. I will like the Arduino to blink repeatedly until the "stop" command is sent to the Arduino. I would eventually like to open a valve, keep it open until the valve receives to the close command then close the valve. The sketch looks like the following, /* * kegboard-serial-simple-blink07 * This code is public domain * * This sketch sends a

The states in this FSM machine are changing too quickly due to an issue with the clock updating the present state

守給你的承諾、 提交于 2019-12-02 07:20:44
I'm in the process of implementing a finite state machine in verilog, and I've encountered an issue. However, I know what the problem is, but I'm not sure how to fix it. This is my current code: module moore_SM(clk, rstn, btn, z, rstLED, state); //Port Assignments input clk, rstn; input [2:0] btn; output z; output reg rstLED; output reg [5:0] state; //Internal Port Assignments reg [1:0] w, x; //NOTE: This is typically the input in FSM, //but it is internal because there is a conversion from btn to w. reg [2:0] y, Y; //Present state and next state respectively reg [2:0] pstBtn; reg [31:0] cnt;

What finite-state machine captures binary strings with equal numbers of '01' and '10'?

此生再无相见时 提交于 2019-12-02 03:41:29
问题 I need help designing a finite state machine that accepts binary strings containing as many occurrences of the pattern 01 as occurrences of the pattern 10 . I kinda have a hard time understanding exactly which strings should be accepted and which should be rejected. Any guidance would be welcome. 回答1: What is the language in question? [...] binary strings containing as many occurrences of the pattern 01 as occurrences of the pattern 10 . I kinda have a hard time understanding exactly which