Package aima.core.environment.map

Examples of aima.core.environment.map.MoveToAction


    mscf = new MapStepCostFunction(aMap);
  }

  @Test
  public void testCosts() {
    Assert.assertEquals(5.0, mscf.c("A", new MoveToAction("B"), "B"), 0.001);
    Assert.assertEquals(6.0, mscf.c("A", new MoveToAction("C"), "C"), 0.001);
    Assert.assertEquals(4.0, mscf.c("B", new MoveToAction("C"), "C"), 0.001);
    Assert.assertEquals(7.0, mscf.c("C", new MoveToAction("D"), "D"), 0.001);
    Assert.assertEquals(14.0, mscf.c("B", new MoveToAction("E"), "E"),
        0.001);
    //
    Assert.assertEquals(5.0, mscf.c("B", new MoveToAction("A"), "A"), 0.001);
    Assert.assertEquals(6.0, mscf.c("C", new MoveToAction("A"), "A"), 0.001);
    Assert.assertEquals(4.0, mscf.c("C", new MoveToAction("B"), "B"), 0.001);
    Assert.assertEquals(7.0, mscf.c("D", new MoveToAction("C"), "C"), 0.001);
    //
    Assert.assertEquals(1.0, mscf.c("X", new MoveToAction("Z"), "Z"), 0.001);
    Assert.assertEquals(1.0, mscf.c("A", new MoveToAction("Z"), "Z"), 0.001);
    Assert.assertEquals(1.0, mscf.c("A", new MoveToAction("D"), "D"), 0.001);
    Assert.assertEquals(1.0, mscf.c("A", new MoveToAction("B"), "E"), 0.001);
  }
View Full Code Here


  }

  @Test
  public void testExecuteAction() {
    me.addAgent(ma, "D");
    me.executeAction(ma, new MoveToAction("C"));
    Assert.assertEquals(me.getAgentLocation(ma), "C");
  }
View Full Code Here

    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");
  }
View Full Code Here

TOP

Related Classes of aima.core.environment.map.MoveToAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.