@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);
ParticleSet updatedWithPerceptionOfUmbrella = predicted
.perceptionUpdate(HmmConstants.SEE_UMBRELLA, r);
Assert.assertEquals(9, updatedWithPerceptionOfUmbrella
.numberOfParticlesWithState(HmmConstants.RAINING));
Assert.assertEquals(1, updatedWithPerceptionOfUmbrella
.numberOfParticlesWithState(HmmConstants.NOT_RAINING));
ParticleSet updatedWithPerceptionOfNoUmbrella = predicted
.perceptionUpdate(HmmConstants.SEE_NO_UMBRELLA, r);
Assert.assertEquals(2, updatedWithPerceptionOfNoUmbrella
.numberOfParticlesWithState(HmmConstants.RAINING));
Assert.assertEquals(8, updatedWithPerceptionOfNoUmbrella
.numberOfParticlesWithState(HmmConstants.NOT_RAINING));
}