public void testTwoAgentsSupported() { SimpleMapAgent ma1 = new SimpleMapAgent(me.getMap(), me, new UniformCostSearch <string, MoveToAction>(), new string[] { "A" }); SimpleMapAgent ma2 = new SimpleMapAgent(me.getMap(), me, new UniformCostSearch <string, MoveToAction>(), new string[] { "A" }); me.addAgent(ma1, "A"); me.addAgent(ma2, "A"); me.executeAction(ma1, new MoveToAction("B")); me.executeAction(ma2, new MoveToAction("C")); Assert.AreEqual(me.getAgentLocation(ma1), "B"); Assert.AreEqual(me.getAgentLocation(ma2), "C"); }
public void setUp() { ExtendableMap aMap = new ExtendableMap(); aMap.addBidirectionalLink("A", "B", 5.0); aMap.addBidirectionalLink("A", "C", 6.0); aMap.addBidirectionalLink("B", "C", 4.0); aMap.addBidirectionalLink("C", "D", 7.0); aMap.addUnidirectionalLink("B", "E", 14.0); me = new MapEnvironment(aMap); ma = new MapAgent(me.getMap(), me, new UniformCostSearch(), new String[] { "A" }); }
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()); }
public void testNoPath() { MapEnvironment me = new MapEnvironment(aMap); MapAgent ma = new MapAgent(me.getMap(), me, new UniformCostSearch(), new String[] { "A" }); me.addAgent(ma, "E"); me.addEnvironmentView(new TestEnvironmentView()); me.stepUntilDone(); Assert .assertEquals( "CurrentLocation=In(E), Goal=In(A):Action[name==NoOp]:METRIC[pathCost]=0:METRIC[maxQueueSize]=1:METRIC[queueSize]=0:METRIC[nodesExpanded]=1:Action[name==NoOp]:", envChanges.ToString()); }
public void setUp() { ExtendableMap aMap = new ExtendableMap(); aMap.addBidirectionalLink("A", "B", 5.0); aMap.addBidirectionalLink("A", "C", 6.0); aMap.addBidirectionalLink("B", "C", 4.0); aMap.addBidirectionalLink("C", "D", 7.0); aMap.addUnidirectionalLink("B", "E", 14.0); me = new MapEnvironment(aMap); ma = new SimpleMapAgent(me.getMap(), me, new UniformCostSearch <string, MoveToAction>(), new string[] { "A" }); }
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()); }
public Map getEnvMap() { return(env.getMap()); }