Package aima.core.util

Examples of aima.core.util.Randomizer


  }

  public static void particleFilterinfDemo() {
    System.out.println("\nParticle Filtering Demo\n");
    HiddenMarkovModel rainman = HMMFactory.createRainmanHMM();
    Randomizer r = new JavaRandomizer();
    ParticleSet starting = rainman.prior().toParticleSet(rainman, r, 1000);
    System.out.println("at the beginning, "
        + starting.numberOfParticlesWithState(HmmConstants.RAINING)
        + " particles 0f 1000 indicate status == 'raining' ");
    System.out.println("at the beginning, "
View Full Code Here


    policy.setAction(new CellWorldPosition(3, 3), CellWorld.RIGHT);

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

    Randomizer r = new JavaRandomizer();
    System.out
        .println("Deriving Utility Function using the Passive ADP Agent  From 100 trials in the 4 by 3 world");
    MDPUtilityFunction<CellWorldPosition> uf = null;
    for (int i = 0; i < 100; i++) {
      agent.executeTrial(r);
View Full Code Here

    policy.setAction(new CellWorldPosition(3, 1), CellWorld.RIGHT);
    policy.setAction(new CellWorldPosition(3, 2), CellWorld.RIGHT);
    policy.setAction(new CellWorldPosition(3, 3), CellWorld.RIGHT);
    PassiveTDAgent<CellWorldPosition, String> agent = new PassiveTDAgent<CellWorldPosition, String>(
        fourByThree, policy);
    Randomizer r = new JavaRandomizer();
    System.out
        .println("Deriving Utility Function in the Passive ADP Agent  From 200 trials in the 4 by 3 world");
    MDPUtilityFunction<CellWorldPosition> uf = null;
    for (int i = 0; i < 200; i++) {
      agent.executeTrial(r);
View Full Code Here

    MDP<CellWorldPosition, String> fourByThree = MDPFactory
        .createFourByThreeMDP();
    ;
    QLearningAgent<CellWorldPosition, String> qla = new QLearningAgent<CellWorldPosition, String>(
        fourByThree);
    Randomizer r = new JavaRandomizer();

    // Randomizer r = new JavaRandomizer();
    // Hashtable<Pair<CellWorldPosition, String>, Double> q = null;
    QTable<CellWorldPosition, String> qTable = null;
    System.out.println("After 100 trials in the 4 by 3 world");
View Full Code Here

    particleSet.add(new Particle(HmmConstants.NOT_RAINING));
  }

  @Test
  public void testFilteringWithParticleSetsWorksForRainmanHmm() {
    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, 100);
    Assert.assertEquals(56,
        starting.numberOfParticlesWithState(HmmConstants.RAINING));
    Assert.assertEquals(44,
View Full Code Here

        .numberOfParticlesWithState(HmmConstants.NOT_RAINING));
  }

  @Test
  public void testFilteringWithParticleSetsForRobotHmm() {
    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 = robot.prior().toParticleSet(robot, r, 100);
    Assert.assertEquals(56,
        starting.numberOfParticlesWithState(HmmConstants.DOOR_OPEN));
    Assert.assertEquals(44,
View Full Code Here

  }

  @Test
  public void testRoundTripConversion() {
    VarDistribution rv = particleSet.toRandomVariable();
    Randomizer r = new MockRandomizer(new double[] { 0.1, 0.2, 0.3, 0.4,
        0.9 });
    ParticleSet ps2 = rv.toParticleSet(rainman, r, 10);
    Assert.assertEquals(8,
        ps2.numberOfParticlesWithState(HmmConstants.RAINING));
    Assert.assertEquals(2,
View Full Code Here

    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

        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

    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

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.