aptacode / statenet Goto Github PK
View Code? Open in Web Editor NEWA small .Net Standard library used to model simple State Machines
Home Page: https://aptacode.com/opensource/statenet/
License: MIT License
A small .Net Standard library used to model simple State Machines
Home Page: https://aptacode.com/opensource/statenet/
License: MIT License
Foreach Probability Chooser:
Determine that altering each Item's Weight results in the correct distribution over a large number of calls to GetChoice.
DeterministicChooser
That it returns the correct Choice given to the constructor.
That it returns the correct choice when updated through the Choice property.
Foreach Node:
OnVisited Fired
OnExited Fired
Moves to an expected node for a given Chooser
GetNextNodes returns expected nodes
ToString returns expected representation
Can update Chooser function
Instead of having to manage the creation of Nodes manually create a 'Node Graph' which based on the number of parameters given to a Factory Method manages the instantiation and connection of nodes.
E.g
nodeGraph.Add("T1", "U1", "U2", "B1", new TernaryProbabilityChooser(1, 1, 1));
nodeGraph.Add("U1", "T1");
nodeGraph.Add("U2", "T1");
nodeGraph.Add("B1", "T1", "End1", new DeterministicChooser(BinaryChoice.Item1));
*** prerequisite ***
#8 (comment)
It would be very helpful for our end users to have a WPF component which allows them to visually define the relationships between nodes.
Determines if the node graph is... well.. valid.
The current approach is very naive and needs lots of work, basically return true if there exists an EndNode which you can reach from the start node.
Improvements:
Some demo apps / examples which would be helpful to include:
Demo's:
Defining a network:
Currently you have to keep a reference to a node and subscribe to its OnVisited event in order to call node.Exit() to move to the next node
For Example:
var T1 = nodeGraph.Create("T1");
T1.OnVisited += (s) =>
{
s.Exit();
};
This must be done for each node or else it will stay on that node forever.
I propose a default 'Instant transition' behaviour which moves to the next node as soo as the node is visited.
Also I propose that a subscriber can be set through the NodeGraph
nodeGraph.Visited("T1", OnT1Visited);
nodeGraph.Visited("T2", (sender)=>{ sender.Exit(); });
Save / Load a graph of nodes from an XML file
The read me needs proof reading, and the examples need updating to reflect recent changes.
A diagram showing a visual representation of the state machines would also be helpful.
When changing the name of a state, if it overlaps with an existing name the new state is lost. For example, with states: Read
, followed by the addition of Ready
.
You can see this in action at the 10 second mark here:
https://vimeo.com/402311839
Password: "statenet"
Currently we define a link like so:
nodeGraph.DeterministicLink("U1", "U2");
this can get a bit clunky in production when the node names are generated on the fly:
nodeGraph.DeterministicLink(myObject.State.ToString(), myObject.State2.ToString());
We should make overloads to the 'Link' methods in the NodeGraph which take Node References so we can do this:
var U1 = nodeGraph.Create(myObject.State.ToString());
var U2 = nodeGraph.Create(myObject.State2.ToString());
nodeGraph.DeterministicLink(U1, U2);
Optionally add a mechanisim where we can mix and match between using a Node reference and the Name
nodeGraph.DeterministicLink(U1, U2, "NewNode");
There are places which return an instance of 'Exception' which lacks any detail.
Node:
All calls to Node.GetNext() should raise an exception if Destination Nodes / Chooser were not set through Visits(...)
Visits(...) should raise an Exception if the nodes / Choosers given are Null
ProbabilityChooser
should raise an exception if all ItemWeights are set to 0
NodeEngine:
Start Method should raise an exception if the graphi is not valid
Comments are lacking, Especially in the NodeMachine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.