state-machine

Probabilistic Automata / Finite state machines in Clojure

拥有回忆 提交于 2019-12-25 07:52:04
问题 Does anyone know of any good resources for probabilistic finite state machines / automata in Clojure? I know of https://github.com/ztellman/automat and https://github.com/cdorrat/reduce-fsm (but I do not think they do what I want). See here: https://en.wikipedia.org/wiki/Probabilistic_automaton My problem is fairly simply (I think): I have multiple states, and transition between them is singular i.e. for now it is just a simple fixed distribution. I am still trying to gain clarity as to if

Cannot install state_machines gem in Windows environment

两盒软妹~` 提交于 2019-12-24 22:26:40
问题 I am new to Rails and would like to check how Spree ecommerce solution looks like before the customization. That's why I installed Ruby from RubyInstaller, DevKit, Rails, Spree etc. During installation of state_machines gem, below error appears and the gem is eventually not installed. C:\>gem install state_machines ERROR: While executing gem ... (Errno::EINVAL) Invalid argument @ rb_sysopen - C:/Dev/Ruby/lib/ruby/gems/2.1.0/gems/state_m achines- 0.2.2/test/unit/node_collection/node_collection

Modeling FSM with conditions?

北城余情 提交于 2019-12-24 11:08:00
问题 I am supposed to model a FSM but I am unsure how to model conditions. Let's take the simple ATM example: If user presses "Confirm" AND PIN is correct, go to State 2. If user presses "Confirm" AND PIN is not correct, go to State 3. Or could I simply use input called "wrong pin" and "correct pin"? I would need it to be formal so that I can employ FSM testing procedures, like cover set generation etc. But I do not know if FSM can be modeled this way (maybe with adding states representing

In state_machine, how do I find which events are valid from the current state?

烂漫一生 提交于 2019-12-24 09:57:57
问题 I am using Aaron Pfeifer's state_machine gem in my Rails3 app -- it's nifty. How do get a list of events are legal in the current state? By this, I do not mean my_model.state_path.events which returns all events transitively traceable from the current state -- I want only those that are available in the current state. I'm pretty sure I'm simply overlooking something obvious. 回答1: Aaron himself answered the question on the PluginAWeek:Core group mailing list: Hi - You can see the list of

Reactive Extensions and parallel processing

折月煮酒 提交于 2019-12-24 07:13:04
问题 I am planning on using Rx within a project of mine at some point, and I have been researching into what I can do with Rx. My project uses TPL for processing state machine transitions in parallel (utilising all available processor cores). However, to improve performance, I want to replace the current IList<> pull mechanism with an Rx push mechanism. As I do not know very much about this technology I want to ascertain whether Rx will be compatible with pushing tokens to the parallel state

Complicated state transitions: best practices

徘徊边缘 提交于 2019-12-24 02:41:52
问题 I work with embedded stuff, and I have some software module that manages hardware. This module has state, and state transitions are complicated: depending on events, the module could go from state A to state B or probably to C . But, when it exits some state, it should perform some actions with the hardware, in order to keep it in correct state too. For rather simple modules, I just have a couple of functions like this: enum state_e { MY_STATE__A, MY_STATE__B, }; static enum state_e _cur

State pattern using methods

你说的曾经没有我的故事 提交于 2019-12-23 18:32:53
问题 I'm trying to implement a simple state machine based on a modified version of the state pattern using methods as states instead of classes, something like this: private Action<Input> currentState; private void NextState(Input i) { currentState(i); } private void State1(Input i) { if( i ... ) currentState = State1; else currentState = State2; } private void State2(Input i) { if( i ... ) currentState = State1; else currentState = State2; } But it would be more elegant if I could do: private

Leaks using GKStateMachine in a Subclass

蓝咒 提交于 2019-12-23 01:50:07
问题 I will show you my actual code. It has three elements: a Helper: import SpriteKit import GameplayKit class GameSceneHelper: SKScene { override func didMove(to view: SKView) { } } A subclass of the helper with some game's states: import SpriteKit import GameplayKit class GameScene: GameSceneHelper { lazy var gameState:GKStateMachine = GKStateMachine(states: [ Introduction(scene: self), SecondState(scene: self) ]) override func didMove(to view: SKView) { self.gameState.enter(Introduction.self)

How to use machine learning to calculate a graph of states from a sequence of data?

你。 提交于 2019-12-22 09:36:33
问题 Generic formulation I have a dataset consisting of a sequence of points with 12 features each. I am interested in detecting an event in this data. In the training data I know the moments the event occurred. When the event occurs I can see an observable pattern in the sequence of points before the event. The pattern is formed from about 300 consecutive points. I am interested in detecting when the event occurred in a infinite sequence of points. The analysis happens post factum. I am not

State Machine Implementations

喜夏-厌秋 提交于 2019-12-22 08:28:53
问题 I am trying to build a board game ... And looks like it has to be implemented using a state machine.. I know of the State pattern from GoF, but I am sure there must be other ways to implement state machine. Please let me know.. if you know of any articles or books that contains details about different implementation (trade off of each of them), please direct me.. thanks 回答1: Check out Ragel. 回答2: We've used Harel's statecharts (similar/equivalent to state machines but somewhat easier to think