Package aima.core.util

Examples of aima.core.util.Randomizer


  @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


  @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

  @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

    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

Related Classes of aima.core.util.Randomizer

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.