Ejemplo n.º 1
0
        private void ExploreUnexploredStates()
        {
            while (_unexploredKnownStates.Count > 0)
            {
                ClusterState state = _unexploredKnownStates.RemoveFirst();

                IEnumerator <Pair <ClusterAction, ClusterState> > newStates = state.Transitions();
                while (newStates.MoveNext())
                {
                    Pair <ClusterAction, ClusterState> next = newStates.Current;
                    Console.WriteLine(_db.numberOfKnownStates() + " (" + _unexploredKnownStates.Count + ")");

                    ClusterState nextState = next.Other();
                    if (!_db.isKnownState(nextState))
                    {
                        _db.newStateTransition(state, next);
                        _unexploredKnownStates.AddLast(nextState);

                        if (nextState.DeadEnd)
                        {
                            Console.WriteLine("DEAD END: " + nextState.ToString() + " (" + _db.id(nextState) + ")");
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public virtual Node NewState(ClusterState state)
        {
            using (Transaction tx = _gds.beginTx())
            {
                Node node = _gds.createNode(label("State"));
                node.SetProperty("description", state.ToString());
                tx.Success();

                _stateNodes[state] = node;
                return(node);
            }
        }