Package aima.core.agent.impl.aprog.simplerule

Examples of aima.core.agent.impl.aprog.simplerule.EQUALCondition


  private static Set<Rule> getRuleSet() {
    // Note: Using a LinkedHashSet so that the iteration order (i.e. implied
    // precedence) of rules can be guaranteed.
    Set<Rule> rules = new LinkedHashSet<Rule>();

    rules.add(new Rule(new ANDCondition(new EQUALCondition(
        ATTRIBUTE_STATE_LOCATION_A,
        VacuumEnvironment.LocationState.Clean), new EQUALCondition(
        ATTRIBUTE_STATE_LOCATION_B,
        VacuumEnvironment.LocationState.Clean)), NoOpAction.NO_OP));
    rules.add(new Rule(new EQUALCondition(ATTRIBUTE_CURRENT_STATE,
        VacuumEnvironment.LocationState.Dirty),
        VacuumEnvironment.ACTION_SUCK));
    rules.add(new Rule(new EQUALCondition(ATTRIBUTE_CURRENT_LOCATION,
        VacuumEnvironment.LOCATION_A),
        VacuumEnvironment.ACTION_MOVE_RIGHT));
    rules.add(new Rule(new EQUALCondition(ATTRIBUTE_CURRENT_LOCATION,
        VacuumEnvironment.LOCATION_B),
        VacuumEnvironment.ACTION_MOVE_LEFT));

    return rules;
  }
View Full Code Here


    // Rules based on REFLEX-VACUUM-AGENT:
    // Artificial Intelligence A Modern Approach (3rd Edition): Figure 2.8,
    // page 48.

    rules.add(new Rule(new EQUALCondition(LocalVacuumEnvironmentPercept.ATTRIBUTE_STATE,
        VacuumEnvironment.LocationState.Dirty),
        VacuumEnvironment.ACTION_SUCK));
    rules.add(new Rule(new EQUALCondition(
        LocalVacuumEnvironmentPercept.ATTRIBUTE_AGENT_LOCATION,
        VacuumEnvironment.LOCATION_A),
        VacuumEnvironment.ACTION_MOVE_RIGHT));
    rules.add(new Rule(new EQUALCondition(
        LocalVacuumEnvironmentPercept.ATTRIBUTE_AGENT_LOCATION,
        VacuumEnvironment.LOCATION_B),
        VacuumEnvironment.ACTION_MOVE_LEFT));

    return rules;
View Full Code Here

    return state;
  }

  private Set<Rule> makeRules() {
    Set<Rule> rules = new HashSet<Rule>();
    rules.add(new Rule(new EQUALCondition(ATTR_CUR_STATE, State.INIT_TOP),
        EnhancedVacuumEnvironment.ACTION_UP));
    rules.add(new Rule(new EQUALCondition(ATTR_CUR_STATE, State.INIT_LEFT),
        EnhancedVacuumEnvironment.ACTION_LEFT));
    rules.add(new Rule(new EQUALCondition(ATTR_CUR_STATE, State.SCAN_LEFT),
        EnhancedVacuumEnvironment.ACTION_LEFT));
    rules.add(new Rule(
        new EQUALCondition(ATTR_CUR_STATE, State.SCAN_RIGHT),
        EnhancedVacuumEnvironment.ACTION_RIGHT));
    rules.add(new Rule(
        new EQUALCondition(ATTR_CUR_STATE, State.SCAN_DOWN_1),
        EnhancedVacuumEnvironment.ACTION_DOWN));
    rules.add(new Rule(
        new EQUALCondition(ATTR_CUR_STATE, State.SCAN_DOWN_2),
        EnhancedVacuumEnvironment.ACTION_DOWN));
    rules.add(new Rule(new EQUALCondition(ATTR_CUR_STATE, State.CLEAN),
        EnhancedVacuumEnvironment.ACTION_CLEAN));
    return rules;
  }
View Full Code Here

  private static Set<Rule> getRuleSet() {
    // Note: Using a LinkedHashSet so that the iteration order (i.e. implied
    // precedence) of rules can be guaranteed.
    Set<Rule> rules = new LinkedHashSet<Rule>();

    rules.add(new Rule(new ANDCondition(new EQUALCondition(
        ATTRIBUTE_STATE_LOCATION_A,
        VacuumEnvironment.LocationState.Clean), new EQUALCondition(
        ATTRIBUTE_STATE_LOCATION_B,
        VacuumEnvironment.LocationState.Clean)), NoOpAction.NO_OP));
    rules.add(new Rule(new EQUALCondition(ATTRIBUTE_CURRENT_STATE,
        VacuumEnvironment.LocationState.Dirty),
        VacuumEnvironment.ACTION_SUCK));
    rules.add(new Rule(new EQUALCondition(ATTRIBUTE_CURRENT_LOCATION,
        VacuumEnvironment.LOCATION_A),
        VacuumEnvironment.ACTION_MOVE_RIGHT));
    rules.add(new Rule(new EQUALCondition(ATTRIBUTE_CURRENT_LOCATION,
        VacuumEnvironment.LOCATION_B),
        VacuumEnvironment.ACTION_MOVE_LEFT));

    return rules;
  }
View Full Code Here

    // Rules based on REFLEX-VACUUM-AGENT:
    // Artificial Intelligence A Modern Approach (3rd Edition): Figure 2.8,
    // page 48.

    rules.add(new Rule(new EQUALCondition(VacuumEnvPercept.ATTRIBUTE_STATE,
        VacuumEnvironment.LocationState.Dirty),
        VacuumEnvironment.ACTION_SUCK));
    rules.add(new Rule(new EQUALCondition(
        VacuumEnvPercept.ATTRIBUTE_AGENT_LOCATION,
        VacuumEnvironment.LOCATION_A),
        VacuumEnvironment.ACTION_MOVE_RIGHT));
    rules.add(new Rule(new EQUALCondition(
        VacuumEnvPercept.ATTRIBUTE_AGENT_LOCATION,
        VacuumEnvironment.LOCATION_B),
        VacuumEnvironment.ACTION_MOVE_LEFT));

    return rules;
View Full Code Here

  private static final String ATTRIBUTE_CAR_IN_FRONT_IS_INDICATING = "car-in-front-is-indicating";
  private static final String ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING = "car-in-front-tires-smoking";

  @Test
  public void testEQUALRule() {
    Rule r = new Rule(new EQUALCondition(ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING,
        true), ACTION_INITIATE_BRAKING);

    Assert.assertEquals(ACTION_INITIATE_BRAKING, r.getAction());

    Assert.assertEquals(
View Full Code Here

        ATTRIBUTE_CAR_IN_FRONT_IS_INDICATING, true)));
  }

  @Test
  public void testNOTRule() {
    Rule r = new Rule(new NOTCondition(new EQUALCondition(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true)),
        ACTION_INITIATE_BRAKING);

    Assert.assertEquals(ACTION_INITIATE_BRAKING, r.getAction());
View Full Code Here

        ATTRIBUTE_CAR_IN_FRONT_IS_INDICATING, true)));
  }

  @Test
  public void testANDRule() {
    Rule r = new Rule(new ANDCondition(new EQUALCondition(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true), new EQUALCondition(
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, true)),
        ACTION_EMERGENCY_BRAKING);

    Assert.assertEquals(ACTION_EMERGENCY_BRAKING, r.getAction());
View Full Code Here

        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, false)));
  }

  @Test
  public void testORRule() {
    Rule r = new Rule(new ORCondition(new EQUALCondition(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true), new EQUALCondition(
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, true)),
        ACTION_EMERGENCY_BRAKING);

    Assert.assertEquals(ACTION_EMERGENCY_BRAKING, r.getAction());
View Full Code Here

TOP

Related Classes of aima.core.agent.impl.aprog.simplerule.EQUALCondition

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.