public void TestBug() { var input = @" declare goal [ root ] refinedby [ case ] m1 [ .3 ], m2 [ .7 ] end declare goal [ m1 ] obstructedby o1 end declare goal [ m2 ] obstructedby o2 end declare obstacle [ o1 ] esr .5 end declare obstacle [ o2 ] esr .5 end " ; var parser = new ModelBuilder(); var model = parser.Parse(input); var pg = model.Goal("root"); var p1 = new ObstructionCaseSuperset(pg); Console.WriteLine("***"); Console.WriteLine(p1.ToDot()); var p2 = new BDDBasedCasePropagator(model); Console.WriteLine(p2.GetESR(pg)); var satisfactionRate = (DoubleSatisfactionRate)p2.GetESR(pg); Assert.AreEqual(0.3 * 0.5 + 0.5 * 0.7, satisfactionRate.SatisfactionRate); }
public void TestSinglePartial() { var input = @" declare goal [ pg ] refinedby sg1 [ .9 ], sg2 end declare goal [ sg1 ] obstructedby o1 end declare goal [ sg2 ] obstructedby o2 end declare obstacle [ o1 ] esr .1 end declare obstacle [ o2 ] esr .1 end " ; var parser = new ModelBuilder(); var model = parser.Parse(input); var pg = model.Goal("pg"); var p1 = new ObstructionCaseSuperset(pg); Console.WriteLine(p1.ToDot()); var p2 = new BDDBasedCasePropagator(model); Console.WriteLine(p2.GetESR(pg)); }