internal static MarkovDecisionProcess Create() { // Just a simple MDP with simple nondeterministic choices // ⟳0⟶1⟲ var mdp = new MarkovDecisionProcess(ModelCapacityByMemorySize.Tiny); mdp.StateFormulaLabels = new string[] { Label1Formula.Label, Label2Formula.Label }; mdp.StateRewardRetrieverLabels = new string[] { }; mdp.StartWithInitialDistributions(); mdp.StartWithNewInitialDistribution(); mdp.AddTransitionToInitialDistribution(0, 1.0); mdp.FinishInitialDistribution(); mdp.FinishInitialDistributions(); mdp.SetStateLabeling(1, new StateFormulaSet(new[] { true, false })); mdp.StartWithNewDistributions(1); mdp.StartWithNewDistribution(); mdp.AddTransition(1, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); mdp.SetStateLabeling(0, new StateFormulaSet(new[] { false, true })); mdp.StartWithNewDistributions(0); mdp.StartWithNewDistribution(); mdp.AddTransition(1, 1.0); mdp.FinishDistribution(); mdp.StartWithNewDistribution(); mdp.AddTransition(0, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); return(mdp); }
internal static MarkovDecisionProcess Create() { // A MDP which was designed to test prob0e // 4 // ⇅ // 0⟼1↘ // ↘2⟼3⟲ var mdp = new MarkovDecisionProcess(ModelCapacityByMemorySize.Tiny); mdp.StateFormulaLabels = new string[] { Label1Formula.Label, Label2Formula.Label }; mdp.StateRewardRetrieverLabels = new string[] { }; mdp.StartWithInitialDistributions(); mdp.StartWithNewInitialDistribution(); mdp.AddTransitionToInitialDistribution(0, 1.0); mdp.FinishInitialDistribution(); mdp.FinishInitialDistributions(); mdp.SetStateLabeling(0, new StateFormulaSet(new[] { false, false })); mdp.StartWithNewDistributions(0); mdp.StartWithNewDistribution(); mdp.AddTransition(1, 1.0); mdp.FinishDistribution(); mdp.StartWithNewDistribution(); mdp.AddTransition(2, 1.0); mdp.FinishDistribution(); mdp.StartWithNewDistribution(); mdp.AddTransition(4, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); mdp.SetStateLabeling(1, new StateFormulaSet(new[] { false, false })); mdp.StartWithNewDistributions(1); mdp.StartWithNewDistribution(); mdp.AddTransition(3, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); mdp.SetStateLabeling(2, new StateFormulaSet(new[] { false, false })); mdp.StartWithNewDistributions(2); mdp.StartWithNewDistribution(); mdp.AddTransition(3, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); mdp.SetStateLabeling(3, new StateFormulaSet(new[] { true, false })); mdp.StartWithNewDistributions(3); mdp.StartWithNewDistribution(); mdp.AddTransition(3, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); mdp.SetStateLabeling(4, new StateFormulaSet(new[] { false, false })); mdp.StartWithNewDistributions(4); mdp.StartWithNewDistribution(); mdp.AddTransition(0, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); return(mdp); }
private void CopyStateLabeling() { for (var i = 0; i < _nmdp.States; i++) { MarkovDecisionProcess.SetStateLabeling(i, _nmdp.StateLabeling[i]); } }
internal static MarkovDecisionProcess Create() { // MDP of [Parker02, page 36] // 0 // ⇅ // 1➞0.6⟼2⟲ // 0.4⟼3⟲ var mdp = new MarkovDecisionProcess(ModelCapacityByMemorySize.Tiny); mdp.StateFormulaLabels = new string[] { Label1Formula.Label, Label2Formula.Label }; mdp.StateRewardRetrieverLabels = new string[] { }; mdp.StartWithInitialDistributions(); mdp.StartWithNewInitialDistribution(); mdp.AddTransitionToInitialDistribution(0, 1.0); mdp.FinishInitialDistribution(); mdp.FinishInitialDistributions(); mdp.SetStateLabeling(0, new StateFormulaSet(new[] { false, false })); mdp.StartWithNewDistributions(0); mdp.StartWithNewDistribution(); mdp.AddTransition(1, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); mdp.SetStateLabeling(1, new StateFormulaSet(new[] { false, false })); mdp.StartWithNewDistributions(1); mdp.StartWithNewDistribution(); mdp.AddTransition(0, 1.0); mdp.FinishDistribution(); mdp.StartWithNewDistribution(); mdp.AddTransition(2, 0.6); mdp.AddTransition(3, 0.4); mdp.FinishDistribution(); mdp.FinishDistributions(); mdp.SetStateLabeling(2, new StateFormulaSet(new[] { true, false })); mdp.StartWithNewDistributions(2); mdp.StartWithNewDistribution(); mdp.AddTransition(2, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); mdp.SetStateLabeling(3, new StateFormulaSet(new[] { false, true })); mdp.StartWithNewDistributions(3); mdp.StartWithNewDistribution(); mdp.AddTransition(3, 1.0); mdp.FinishDistribution(); mdp.FinishDistributions(); return(mdp); }