public void Setup()
        {
            var complex1 = new STRIPS.ComplexGoal();

            complex1.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact("tst")));
            complex1.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact("on")));
            var complex2 = new STRIPS.ComplexGoal();

            complex2.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact("tst")));
            _result = complex1.IsSame(complex2);
        }
Пример #2
0
        public void Setup()
        {
            var table   = new Table();
            var actions = new List <STRIPS.Action>
            {
                new PickupAction(table),
                new PutDownAction(table),
                new StackAction(),
                new UnstackAction()
            };
            var black  = new Block(Color.Black, table);
            var red    = new Block(Color.Red, table);
            var yellow = new Block(Color.Yellow, red);
            var green  = new Block(Color.Green, black);

            var itemsToProcess = new Stack <IStackItem>();

            _complexGoal = new STRIPS.ComplexGoal();
            _complexGoal.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(black), new STRIPS.ValueParameter(green))));
            _complexGoal.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(green), new STRIPS.ValueParameter(table))));
            itemsToProcess.Push(_complexGoal);
            var currentBeliefs = new List <STRIPS.Fact>
            {
                new STRIPS.Fact(Definitions.ArmHolds, new STRIPS.ValueParameter(null)),
                new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(black), new STRIPS.ValueParameter(table)),
                new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(red), new STRIPS.ValueParameter(table)),
                new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(green), new STRIPS.ValueParameter(black)),
                new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(yellow), new STRIPS.ValueParameter(red)),
                new STRIPS.Fact(Definitions.Clear, new STRIPS.ValueParameter(green)),
                new STRIPS.Fact(Definitions.Clear, new STRIPS.ValueParameter(yellow))
            };

            (_result, _beliefs) = STRIPS.Planner.CreatePlan <STRIPS.Action>(itemsToProcess, currentBeliefs.ToList(), new List <STRIPS.Fact>(), new List <State>(), actions);

            var itemsToProcess2 = new Stack <IStackItem>();

            _complexGoal2 = new STRIPS.ComplexGoal();
            _complexGoal2.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(black), new STRIPS.ValueParameter(green))));
            _complexGoal2.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(green), new STRIPS.ValueParameter(table))));
            itemsToProcess2.Push(_complexGoal2);
            (_result2, _beliefs2) = STRIPS.Planner.CreatePlan <STRIPS.Action>(itemsToProcess2, currentBeliefs.ToList(), new List <STRIPS.Fact>(), new List <State>(), actions);

            var itemsToProcess3 = new Stack <IStackItem>();

            _complexGoal3 = new STRIPS.ComplexGoal();
            _complexGoal3.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.Clear, new STRIPS.ValueParameter(yellow))));
            _complexGoal3.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(yellow), new STRIPS.ValueParameter(red))));
            _complexGoal3.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(red), new STRIPS.ValueParameter(black))));
            _complexGoal3.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(black), new STRIPS.ValueParameter(green))));
            _complexGoal3.Goals.Add(new STRIPS.SimpleGoal(new STRIPS.Fact(Definitions.On, new STRIPS.ValueParameter(green), new STRIPS.ValueParameter(table))));
            itemsToProcess3.Push(_complexGoal3);
            (_result3, _beliefs3) = STRIPS.Planner.CreatePlan <STRIPS.Action>(itemsToProcess3, currentBeliefs.ToList(), new List <STRIPS.Fact>(), new List <State>(), actions);
        }
Пример #3
0
        public void Setup()
        {
            _subGoal1 = new Mock <STRIPS.SimpleGoal>(new STRIPS.Fact("name"));
            _subGoal1.Setup(x => x.IsFulFilled(It.IsAny <List <STRIPS.Fact> >())).Returns(true);
            _subGoal2 = new Mock <STRIPS.SimpleGoal>(new STRIPS.Fact("name"));
            _subGoal2.Setup(x => x.IsFulFilled(It.IsAny <List <STRIPS.Fact> >())).Returns(true);
            var goal = new STRIPS.ComplexGoal();

            goal.Goals.Add(_subGoal1.Object);
            goal.Goals.Add(_subGoal2.Object);
            _result = goal.IsFulFilled(_facts);
        }
Пример #4
0
        public void Setup()
        {
            _subFact1 = new Mock <STRIPS.Fact>("name");
            _subFact1.Setup(x => x.IsSameAs(It.IsAny <STRIPS.Fact>())).Returns(true);
            _subFact2 = new Mock <STRIPS.Fact>("name2");
            _subFact2.Setup(x => x.IsSameAs(It.IsAny <STRIPS.Fact>())).Returns(true);

            var subGoal1 = new STRIPS.SimpleGoal(_subFact1.Object);
            var subGoal2 = new STRIPS.SimpleGoal(_subFact2.Object);
            var complex1 = new STRIPS.ComplexGoal();

            complex1.Goals.Add(subGoal1);
            complex1.Goals.Add(subGoal2);
            var complex2 = new STRIPS.ComplexGoal();

            complex2.Goals.Add(subGoal1);
            complex2.Goals.Add(subGoal2);
            _result = complex1.IsSame(complex2);
        }
Пример #5
0
 public void Setup()
 {
     _result = new STRIPS.ComplexGoal();
 }