Package aima.core.agent.impl

Examples of aima.core.agent.impl.DynamicPercept


    return state;
  }

  @Override
  public Percept getPerceptSeenBy(Agent anAgent) {
    return new DynamicPercept(DynAttributeNames.PERCEPT_IN,
        getAgentLocation(anAgent));
  }
View Full Code Here


    return envState;
  }

  @Override
  public Percept getPerceptSeenBy(Agent anAgent) {
    return new DynamicPercept();
  }
View Full Code Here

public class PerceptSequenceTest {

  @Test
  public void testToString() {
    List<Percept> ps = new ArrayList<Percept>();
    ps.add(new DynamicPercept("key1", "value1"));

    Assert.assertEquals("[Percept[key1==value1]]", ps.toString());

    ps.add(new DynamicPercept("key1", "value1", "key2", "value2"));

    Assert.assertEquals(
        "[Percept[key1==value1], Percept[key1==value1, key2==value2]]",
        ps.toString());
  }
View Full Code Here

    List<Percept> ps1 = new ArrayList<Percept>();
    List<Percept> ps2 = new ArrayList<Percept>();

    Assert.assertEquals(ps1, ps2);

    ps1.add(new DynamicPercept("key1", "value1"));

    Assert.assertNotSame(ps1, ps2);

    ps2.add(new DynamicPercept("key1", "value1"));

    Assert.assertEquals(ps1, ps2);
  }
View Full Code Here

public class DynamicPerceptTest {

  @Test
  public void testToString() {
    DynamicPercept p = new DynamicPercept("key1", "value1");

    Assert.assertEquals("Percept[key1==value1]", p.toString());

    p = new DynamicPercept("key1", "value1", "key2", "value2");

    Assert.assertEquals("Percept[key1==value1, key2==value2]", p.toString());
  }
View Full Code Here

    Assert.assertEquals("Percept[key1==value1, key2==value2]", p.toString());
  }

  @Test
  public void testEquals() {
    DynamicPercept p1 = new DynamicPercept();
    DynamicPercept p2 = new DynamicPercept();

    Assert.assertEquals(p1, p2);

    p1 = new DynamicPercept("key1", "value1");

    Assert.assertNotSame(p1, p2);

    p2 = new DynamicPercept("key1", "value1");

    Assert.assertEquals(p1, p2);
  }
View Full Code Here

  private AbstractAgent agent;

  @Before
  public void setUp() {
    Map<List<Percept>, Action> perceptSequenceActions = new HashMap<List<Percept>, Action>();
    perceptSequenceActions.put(createPerceptSequence(new DynamicPercept(
        "key1", "value1")), ACTION_1);
    perceptSequenceActions.put(
        createPerceptSequence(new DynamicPercept("key1", "value1"),
            new DynamicPercept("key1", "value2")), ACTION_2);
    perceptSequenceActions.put(
        createPerceptSequence(new DynamicPercept("key1", "value1"),
            new DynamicPercept("key1", "value2"),
            new DynamicPercept("key1", "value3")), ACTION_3);

    agent = new MockAgent(new TableDrivenAgentProgram(
        perceptSequenceActions));
  }
View Full Code Here

  }

  @Test
  public void testExistingSequences() {
    Assert.assertEquals(ACTION_1,
        agent.execute(new DynamicPercept("key1", "value1")));
    Assert.assertEquals(ACTION_2,
        agent.execute(new DynamicPercept("key1", "value2")));
    Assert.assertEquals(ACTION_3,
        agent.execute(new DynamicPercept("key1", "value3")));
  }
View Full Code Here

  }

  @Test
  public void testNonExistingSequence() {
    Assert.assertEquals(ACTION_1,
        agent.execute(new DynamicPercept("key1", "value1")));
    Assert.assertEquals(NoOpAction.NO_OP,
        agent.execute(new DynamicPercept("key1", "value3")));
  }
View Full Code Here

    Assert.assertEquals(
        "if car-in-front-is-braking==true then Action[name==initiate-braking].",
        r.toString());

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true)));

    Assert.assertEquals(false, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, false)));

    Assert.assertEquals(false, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_INDICATING, true)));
  }
View Full Code Here

TOP

Related Classes of aima.core.agent.impl.DynamicPercept

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.