Пример #1
0
 private TransitionCollection ConvertTransitions(LabeledTransitionMarkovChain.LabeledTransitionEnumerator enumerator)
 {
     TemporaryStateStorage.Clear();
     _transitions.Clear();
     while (enumerator.MoveNext())
     {
         var targetStateFormulaSet = DeriveNewStateFormulaSet(enumerator.CurrentFormulas);
         _transitions.AddTransition(enumerator.CurrentTargetState, enumerator.CurrentProbability, targetStateFormulaSet);
     }
     return(_transitions.ToCollection());
 }
Пример #2
0
        private static void ExportDistribution(LabeledTransitionMarkovChain markovChain, TextWriter sb, string sourceStateName, LabeledTransitionMarkovChain.LabeledTransitionEnumerator distribution)
        {
            while (distribution.MoveNext())
            {
                sb.Write($"{sourceStateName} -> {distribution.CurrentTargetState} [label=\"{Probability.PrettyPrint(distribution.CurrentProbability)}");

                for (int i = 0; i < markovChain.StateFormulaLabels.Length; i++)
                {
                    if (i == 0)
                    {
                        sb.Write("\\n");
                    }
                    else
                    {
                        sb.Write(",");
                    }
                    if (distribution.CurrentFormulas[i])
                    {
                        sb.Write("t");
                    }
                    else
                    {
                        sb.Write("f");
                    }
                }
                sb.WriteLine("\"];");
            }
        }