示例#1
0
        public void testNoPath()
        {
            MapEnvironment me = new MapEnvironment(aMap);
            SimpleMapAgent ma = new SimpleMapAgent(me.getMap(), me, new UniformCostSearch <string, MoveToAction>(), new string[] { "A" });

            me.addAgent(ma, "E");
            me.AddEnvironmentView(new TestEnvironmentView(envChanges));
            me.StepUntilDone();

            Assert.AreEqual(
                "CurrentLocation=In(E), Goal=In(A):Action[name==NoOp]:METRIC[nodesExpanded]=1:METRIC[queueSize]=0:METRIC[maxQueueSize]=1:METRIC[pathCost]=0:Action[name==NoOp]:",
                envChanges.ToString());
        }
示例#2
0
        public void testNormalSearchGraphSearchMinFrontier()
        {
            MapEnvironment me = new MapEnvironment(aMap);
            UniformCostSearch <string, MoveToAction> ucSearch = new UniformCostSearch <string, MoveToAction>(new GraphSearchReducedFrontier <string, MoveToAction>());

            SimpleMapAgent ma = new SimpleMapAgent(me.getMap(), me, ucSearch, new string[] { "D" });

            me.addAgent(ma, "A");
            me.AddEnvironmentView(new TestEnvironmentView(envChanges));
            me.StepUntilDone();

            Assert.AreEqual(
                "CurrentLocation=In(A), Goal=In(D):Action[name==moveTo, location==C]:Action[name==moveTo, location==D]:METRIC[nodesExpanded]=3:METRIC[queueSize]=1:METRIC[maxQueueSize]=2:METRIC[pathCost]=13:Action[name==NoOp]:",
                envChanges.ToString());
        }
        public void test_A_StartingAtGoal()
        {
            ExtendableMap aMap = new ExtendableMap();

            MapEnvironment me = new MapEnvironment(aMap);
            SimpleMapAgent ma = new SimpleMapAgent(me.getMap(), me, search, new string[] { "A" });

            me.addAgent(ma, "A");
            me.AddEnvironmentView(new BDSEnvironmentView(envChanges));
            me.StepUntilDone();

            Assert.AreEqual(
                "CurrentLocation=In(A), Goal=In(A):Action[name==NoOp]:METRIC[nodesExpanded]=0:METRIC[queueSize]=0:METRIC[maxQueueSize]=0:METRIC[pathCost]=0:Action[name==NoOp]:",
                envChanges.ToString());
        }
        public void test_AB_BothWaysPath()
        {
            ExtendableMap aMap = new ExtendableMap();

            aMap.addBidirectionalLink("A", "B", 5.0);

            MapEnvironment me = new MapEnvironment(aMap);
            SimpleMapAgent ma = new SimpleMapAgent(me.getMap(), me, search, new string[] { "B" });

            me.addAgent(ma, "A");
            me.AddEnvironmentView(new BDSEnvironmentView(envChanges));
            me.StepUntilDone();

            Assert.AreEqual(
                "CurrentLocation=In(A), Goal=In(B):Action[name==moveTo, location==B]:METRIC[nodesExpanded]=1:METRIC[queueSize]=1:METRIC[maxQueueSize]=2:METRIC[pathCost]=5:Action[name==NoOp]:",
                envChanges.ToString());
        }
        public void test_ABCDEF_ReverseFirstButNotFromOriginal()
        {
            ExtendableMap aMap = new ExtendableMap();

            aMap.addBidirectionalLink("A", "B", 5.0);
            aMap.addBidirectionalLink("B", "C", 5.0);
            aMap.addBidirectionalLink("C", "D", 5.0);
            aMap.addBidirectionalLink("D", "E", 5.0);
            aMap.addBidirectionalLink("E", "F", 5.0);
            aMap.addUnidirectionalLink("E", "A", 5.0);

            MapEnvironment me = new MapEnvironment(aMap);
            SimpleMapAgent ma = new SimpleMapAgent(me.getMap(), me, search, new string[] { "F" });

            me.addAgent(ma, "A");
            me.AddEnvironmentView(new BDSEnvironmentView(envChanges));
            me.StepUntilDone();

            Assert.AreEqual(
                "CurrentLocation=In(A), Goal=In(F):Action[name==moveTo, location==B]:Action[name==moveTo, location==C]:Action[name==moveTo, location==D]:Action[name==moveTo, location==E]:Action[name==moveTo, location==F]:METRIC[nodesExpanded]=6:METRIC[queueSize]=1:METRIC[maxQueueSize]=2:METRIC[pathCost]=25:Action[name==NoOp]:",
                envChanges.ToString());
        }