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); 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 testTwoAgentsSupported() { MapAgent ma1 = new MapAgent(me.getMap(), me, new UniformCostSearch(), new String[] { "A" }); MapAgent ma2 = new MapAgent(me.getMap(), me, new UniformCostSearch(), new String[] { "A" }); me.addAgent(ma1, "A"); me.addAgent(ma2, "A"); me.executeAction(ma1, new MoveToAction("B")); me.executeAction(ma2, new MoveToAction("C")); Assert.assertEquals(me.getAgentLocation(ma1), "B"); Assert.assertEquals(me.getAgentLocation(ma2), "C"); }