Пример #1
0
 public void ConvertTransitions()
 {
     for (var i = 0; i < MdpStates; i++)
     {
         var sourceEntry = _backMapper[i];
         var cid         = _ltmdp.GetRootContinuationGraphLocationOfState(sourceEntry.StateStorageState);
         ClearStepGraphMapper(cid);
         var locationOfStateRoot = NestedMarkovDecisionProcess.GetPlaceForNewContinuationGraphElements(1);
         NestedMarkovDecisionProcess.SetRootContinuationGraphLocationOfState(i, locationOfStateRoot);
         AddNodesOfContinuationId(cid, locationOfStateRoot);
     }
 }
Пример #2
0
            public UnderlyingDigraph(LabeledTransitionMarkovDecisionProcess ltmdp)
            {
                //Assumption "every node is reachable" is fulfilled due to the construction
                _ltmdp = ltmdp;
                _transitionTargetNo = ltmdp.TransitionTargets;
                _cidNo     = ltmdp.ContinuationGraphSize;
                _stateNo   = ltmdp.SourceStates.Count;
                _baseGraph = new BidirectionalGraph <EdgeType>();

                var initialCid = _ltmdp.GetRootContinuationGraphLocationOfInitialState();

                AddNodesOfContinuationId(initialCid);

                foreach (var sourceState in _ltmdp.SourceStates)
                {
                    var stateRootCid = _ltmdp.GetRootContinuationGraphLocationOfState(sourceState);
                    AddNodesOfContinuationId(stateRootCid);
                    AddStateToRootCidTransition(sourceState, stateRootCid);
                }
                AddTransitionTargets();
            }
Пример #3
0
        public static void ExportToGv(this LabeledTransitionMarkovDecisionProcess ltmdp, TextWriter sb)
        {
            sb.WriteLine("digraph S {");
            //sb.WriteLine("size = \"8,5\"");
            sb.WriteLine("node [shape=box];");

            var initialStateName = "initialState";

            sb.WriteLine($" {initialStateName} [shape=point,width=0.0,height=0.0,label=\"\"];");
            var initialCid = ltmdp.GetRootContinuationGraphLocationOfInitialState();

            ExportCid(ltmdp, sb, initialStateName, false, initialCid);

            foreach (var state in ltmdp.SourceStates)
            {
                sb.Write($" {state} [label=\"{state}");
                sb.WriteLine("\"];");

                var cid      = ltmdp.GetRootContinuationGraphLocationOfState(state);
                var fromNode = state.ToString();
                ExportCid(ltmdp, sb, fromNode, false, cid);
            }
            sb.WriteLine("}");
        }