Package aima.core.environment.map

Examples of aima.core.environment.map.ExtendableMap


     * Configures a scenario and a list of destinations. Note that for route
     * finding problems, the size of the list needs to be 1.
     */
    @Override
    protected void selectScenarioAndDest(int scenarioIdx, int destIdx) {
      ExtendableMap map = new ExtendableMap();
      MapEnvironment env = new MapEnvironment(map);
      String agentLoc = null;
      switch (scenarioIdx) {
      case 0:
        SimplifiedRoadMapOfPartOfRomania.initMap(map);
        agentLoc = SimplifiedRoadMapOfPartOfRomania.ARAD;
        break;
      case 1:
        SimplifiedRoadMapOfPartOfRomania.initMap(map);
        agentLoc = SimplifiedRoadMapOfPartOfRomania.LUGOJ;
        break;
      case 2:
        SimplifiedRoadMapOfPartOfRomania.initMap(map);
        agentLoc = SimplifiedRoadMapOfPartOfRomania.FAGARAS;
        break;
      case 3:
        SimplifiedRoadMapOfAustralia.initMap(map);
        agentLoc = SimplifiedRoadMapOfAustralia.SYDNEY;
        break;
      case 4:
        SimplifiedRoadMapOfAustralia.initMap(map);
        agentLoc = map.randomlyGenerateDestination();
        break;
      }
      scenario = new Scenario(env, map, agentLoc);

      destinations = new ArrayList<String>();
      if (scenarioIdx < 3) {
        switch (destIdx) {
        case 0:
          destinations
              .add(SimplifiedRoadMapOfPartOfRomania.BUCHAREST);
          break;
        case 1:
          destinations.add(SimplifiedRoadMapOfPartOfRomania.EFORIE);
          break;
        case 2:
          destinations.add(SimplifiedRoadMapOfPartOfRomania.NEAMT);
          break;
        case 3:
          destinations.add(map.randomlyGenerateDestination());
          break;
        }
      } else {
        switch (destIdx) {
        case 0:
          destinations.add(SimplifiedRoadMapOfAustralia.PORT_HEDLAND);
          break;
        case 1:
          destinations.add(SimplifiedRoadMapOfAustralia.ALBANY);
          break;
        case 2:
          destinations.add(SimplifiedRoadMapOfAustralia.MELBOURNE);
          break;
        case 3:
          destinations.add(map.randomlyGenerateDestination());
          break;
        }
      }
    }
View Full Code Here


        search.getMetrics().get(QueueSearch.METRIC_PATH_COST));
  }

  @Test
  public void testCheckFrontierPathCost() throws Exception {
    ExtendableMap map = new ExtendableMap();
    map.addBidirectionalLink("start", "b", 2.5);
    map.addBidirectionalLink("start", "c", 1.0);
    map.addBidirectionalLink("b", "d", 2.0);
    map.addBidirectionalLink("c", "d", 4.0);
    map.addBidirectionalLink("c", "e", 1.0);
    map.addBidirectionalLink("d", "goal", 1.0);
    map.addBidirectionalLink("e", "goal", 5.0);
    Problem problem = new Problem("start",
        MapFunctionFactory.getActionsFunction(map),
        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            "goal"), new MapStepCostFunction(map));
View Full Code Here

  //
  // Test I(A)->(B)->(C)<->(D)<->G(E)
  @Test
  public void test_ABCDE_OriginalOnlyPath() {
    ExtendableMap aMap = new ExtendableMap();
    aMap.addBidirectionalLink("A", "B", 5.0);
    aMap.addUnidirectionalLink("B", "C", 5.0);
    aMap.addBidirectionalLink("C", "D", 5.0);
    aMap.addBidirectionalLink("D", "E", 5.0);

    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, bidirectionalSearch,
        new String[] { "E" });
    me.addAgent(ma, "A");
View Full Code Here

  //
  // Test I(A)<-G(B)
  @Test
  public void test_AB_ReverseOnlyPath() {
    ExtendableMap aMap = new ExtendableMap();
    aMap.addUnidirectionalLink("B", "A", 5.0);

    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, bidirectionalSearch,
        new String[] { "B" });
    me.addAgent(ma, "A");
View Full Code Here

  //
  // Test I(A)<-(B)<-G(C)
  @Test
  public void test_ABC_ReverseOnlyPath() {
    ExtendableMap aMap = new ExtendableMap();
    aMap.addUnidirectionalLink("B", "A", 5.0);
    aMap.addUnidirectionalLink("C", "B", 5.0);

    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, bidirectionalSearch,
        new String[] { "C" });
    me.addAgent(ma, "A");
View Full Code Here

  }

  // Test I(A)<->(B)<->(C)<-(D)<-G(E)
  @Test
  public void test_ABCDE_ReverseOnlyPath() {
    ExtendableMap aMap = new ExtendableMap();
    aMap.addBidirectionalLink("A", "B", 5.0);
    aMap.addBidirectionalLink("B", "C", 5.0);
    aMap.addUnidirectionalLink("D", "C", 5.0);
    aMap.addUnidirectionalLink("E", "D", 5.0);

    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, bidirectionalSearch,
        new String[] { "E" });
    me.addAgent(ma, "A");
View Full Code Here

   *              --------------------------------------
   * </code>
   */
  @Test
  public void test_ABCDEF_OriginalFirst() {
    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.addBidirectionalLink("F", "G", 5.0);
    aMap.addBidirectionalLink("G", "H", 5.0);
    aMap.addUnidirectionalLink("B", "H", 5.0);

    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, bidirectionalSearch,
        new String[] { "H" });
    me.addAgent(ma, "A");
View Full Code Here

   *        -------------------------
   * </code>
   */
  @Test
  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);
    MapAgent ma = new MapAgent(me.getMap(), me, bidirectionalSearch,
        new String[] { "F" });
    me.addAgent(ma, "A");
View Full Code Here

   *        -------------------------
   * </code>
   */
  @Test
  public void test_ABCDEF_MoreComplexReverseFirstButNotFromOriginal() {
    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.addUnidirectionalLink("F", "E", 5.0);
    aMap.addBidirectionalLink("E", "A", 5.0);
    aMap.addBidirectionalLink("D", "F", 5.0);

    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, bidirectionalSearch,
        new String[] { "F" });
    me.addAgent(ma, "A");
View Full Code Here

  ActionsFunction af;
  ResultFunction rf;

  @Before
  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);

    af = MapFunctionFactory.getActionsFunction(aMap);
    rf = MapFunctionFactory.getResultFunction();
  }
View Full Code Here

TOP

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

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.