Examples of MockRandomizer


Examples of aima.core.util.MockRandomizer

    Assert.assertEquals(state2, HmmConstants.NOT_RAINING);
  }

  @Test
  public void testParticleSetForPredictedStateGeneratedFromOldStateParticleSet() {
    Randomizer r = new MockRandomizer(new double[] { 0.1, 0.2, 0.3, 0.4,
        0.5, 0.6, 0.7, 0.8, 0.9 });
    ParticleSet ps = rainman.prior().toParticleSet(rainman, r, 10);
    Assert.assertEquals(6,
        ps.numberOfParticlesWithState(HmmConstants.RAINING));
    Assert.assertEquals(4,
View Full Code Here

Examples of aima.core.util.MockRandomizer

        nps.numberOfParticlesWithState(HmmConstants.NOT_RAINING));
  }

  @Test
  public void testParticleSetForPerceptionUpdatedStateGeneratedFromPredictedStateParticleSetGivenPerception() {
    Randomizer r = new MockRandomizer(new double[] { 0.1, 0.2, 0.3, 0.4,
        0.5, 0.6, 0.7, 0.8, 0.9 });
    ParticleSet starting = rainman.prior().toParticleSet(rainman, r, 10);
    ParticleSet predicted = starting
        .generateParticleSetForPredictedState(r);
View Full Code Here

Examples of aima.core.util.MockRandomizer

    cw.setReward(2, 4, -1);

    cw.setTerminalState(3, 4);
    cw.setReward(3, 4, 1);

    alwaysLessThanEightyPercent = new MockRandomizer(new double[] { 0.7 });
    betweenEightyAndNinetyPercent = new MockRandomizer(
        new double[] { 0.85 });
    greaterThanNinetyPercent = new MockRandomizer(new double[] { 0.95 });
  }
View Full Code Here

Examples of aima.core.util.MockRandomizer

    PassiveADPAgent<CellWorldPosition, String> agent = new PassiveADPAgent<CellWorldPosition, String>(
        fourByThree, policy);

    // Randomizer r = new JavaRandomizer();
    Randomizer r = new MockRandomizer(new double[] { 0.1, 0.9, 0.2, 0.8,
        0.3, 0.7, 0.4, 0.6, 0.5 });
    MDPUtilityFunction<CellWorldPosition> uf = null;
    for (int i = 0; i < 100; i++) {
      agent.executeTrial(r);
      uf = agent.getUtilityFunction();
View Full Code Here

Examples of aima.core.util.MockRandomizer

  @Test
  public void testPassiveTDAgent() {
    PassiveTDAgent<CellWorldPosition, String> agent = new PassiveTDAgent<CellWorldPosition, String>(
        fourByThree, policy);
    // Randomizer r = new JavaRandomizer();
    Randomizer r = new MockRandomizer(new double[] { 0.1, 0.9, 0.2, 0.8,
        0.3, 0.7, 0.4, 0.6, 0.5 });
    MDPUtilityFunction<CellWorldPosition> uf = null;
    for (int i = 0; i < 200; i++) {
      agent.executeTrial(r);
      uf = agent.getUtilityFunction();
View Full Code Here

Examples of aima.core.util.MockRandomizer

  @SuppressWarnings("unused")
  @Test
  public void testQLearningAgent() {
    QLearningAgent<CellWorldPosition, String> qla = new QLearningAgent<CellWorldPosition, String>(
        fourByThree);
    Randomizer r = new MockRandomizer(new double[] { 0.1, 0.9, 0.2, 0.8,
        0.3, 0.7, 0.4, 0.6, 0.5 });

    // Randomizer r = new JavaRandomizer();
    Hashtable<Pair<CellWorldPosition, String>, Double> q = null;
    QTable<CellWorldPosition, String> qTable = null;
View Full Code Here

Examples of aima.core.util.MockRandomizer

  @Test
  public void testFirstStepsOfQLAAgentUnderNormalProbability() {
    QLearningAgent<CellWorldPosition, String> qla = new QLearningAgent<CellWorldPosition, String>(
        fourByThree);

    Randomizer alwaysLessThanEightyPercent = new MockRandomizer(
        new double[] { 0.7 });
    CellWorldPosition startingPosition = new CellWorldPosition(1, 4);
    String action = qla.decideAction(new MDPPerception<CellWorldPosition>(
        startingPosition, -0.04));
    Assert.assertEquals(CellWorld.LEFT, action);
View Full Code Here

Examples of aima.core.util.MockRandomizer

    CellWorldPosition startingPosition = new CellWorldPosition(1, 4);
    String action = qla.decideAction(new MDPPerception<CellWorldPosition>(
        startingPosition, -0.04));
    Assert.assertEquals(CellWorld.LEFT, action);

    Randomizer betweenEightyANdNinetyPercent = new MockRandomizer(
        new double[] { 0.85 }); // to force left to become an "up"
    qla.execute(action, betweenEightyANdNinetyPercent);
    Assert.assertEquals(new CellWorldPosition(2, 4), qla.getCurrentState());
    Assert.assertEquals(-1.0, qla.getCurrentReward(), 0.001);
    Assert.assertEquals(0.0,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.