Comments (3)
No, had not thought of that before. Sounds interesting.
For nondeterministic transition how would the choice be made - some sort of probability distribution ? That could be fairly easy to implement.
For epsilon transition - I might have to go do some reading to find out exactly what you mean - are they transitions that occur at unpredictable times without an explicit event call ? what causes them to fire then another probability distribution ?
Don't really have any particular goals for the library. It started out to help with managing state for some simple HTML5 games... I could imagine more advanced games could use features like these.
I should go do a little reading...
from javascript-state-machine.
Yep, the wikipedia article is not that bad for starters.
The implementation of nondeterminism and epsilon transitions kind of depends on what you want the library to be used for. If it is going to be a library for providing a theoretical framework for working with FSMs, then the implementation should follow the rules of FSMs as in the wiki article. That means that the model should not include probabilities and that there is no concept of choice, rather the FSM enters two or more states after a nondeterministic transition (i.e. the current state of the system is a set of states of the FSM). For epsilon transitions this means that in any state the system would check if there are epsilon transitions available from that state to some other states, and it would add those other states to the current state (which is, again, a set of states of the FSM). This kind of model can then be used for various analyses and transformations -- the FSM can be minimized with regard to the number of states or input symbols, you can compute the reachable states, etc. etc.
However, if you want the library to be used for practical modeling -- then, yes, the model should provide a way to define practical factors such as probabilities. And these probabilities could be used to pick a state from a set of states in a nondeterministic transition and the system would always be in a single state. This is more similar to real systems since real systems can't be in two states at a time, but also limits the usage of the library for theoretical modeling and analysis. For example, it is possible that a machine created using this approach never enters a specific state although there actually is a small probability of entering that state. This is bad for testing and verification since it is nondeterministic :)
A third approach may be to have a combination of the two approaches -- you permit the definition of probabilities for transitions (As in the second approach), but the FSM transitions to a set of states (as in the first approach). However, after making a transition, the FSM remembers the probabilities of each state it has transitioned to. So, the current state of the FSM would look like: [ { name : "state1", probability : 0.99}, { name : "state2", probability : 0.01}]... and by making more transitions, you add up the probabilities from the previous state. I like this approach since it's adaptable two any use-case.
Anyway, it's an interesting thing to think about for the future of the library :).
from javascript-state-machine.
Definitely seems like a good advanced feature to have in the future, but most likely wont get done any time soon, sorry. I'll keep it on the TODO list.
Thanks!
from javascript-state-machine.
Related Issues (20)
- providing in config listener returning promise makes transition unusable HOT 1
- v3.0+ has no type definition file for typescript. HOT 3
- Create a state machine from a string (e.g, regular expression)
- Automatic transitions from one state to another
- Is the data type of the status value not allowed to be int? HOT 1
- Why is there onEnter* fired on state machine initialization? HOT 2
- Typo in Docs?
- how to change transitions in event HOT 1
- how to refer to data in state transition functions HOT 1
- Machine Runtime Configuration
- conditional transitions break the visualisation
- Init state machine with async transitions
- Get the next state from an event
- Pending transition HOT 1
- .can(transition) doesn't work as expected.
- Consider adding a lang attribute to the html start tag to declare the language of this document. (Validation)
- Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.
- Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.
- Hierarchical state machine via the factory design?
- Warning: .can will cause a conditional transaction function to be called twice
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascript-state-machine.