use of nars.rl.horde.HordeScheduler in project narchy by automenta.
the class HordeSchedulerTest method testScheduler.
@Test
public void testScheduler() {
RealVector o_tp1 = new ArrayRealVector(1);
FakeDemon d1 = new FakeDemon(), d2 = new FakeDemon();
final List<FakeDemon> demons = Lists.newArrayList(d1, d2);
final FakeFunction[] beforeFunctions = { new FakeFunction(d1), new FakeFunction(d2) };
final FakeFunction[] afterFunctions = { new FakeFunction(d1), new FakeFunction(d2) };
Horde horde = new Horde(new HordeScheduler(3));
horde.beforeFunctions().addAll(Lists.newArrayList(beforeFunctions));
horde.demons().addAll(demons);
horde.afterFunctions().addAll(Lists.newArrayList(afterFunctions));
final RealVector x0 = new ArrayRealVector(1), x1 = new ArrayRealVector(1);
final Integer a0 = 0;
checkFunction(beforeFunctions, null, null, null, null, false);
checkFunction(afterFunctions, null, null, null, null, false);
horde.update(o_tp1, x0, a0, x1);
checkFunction(beforeFunctions, x0, a0, o_tp1, x1, false);
checkFunction(afterFunctions, x0, a0, o_tp1, x1, true);
checkDemon(d1, x0, a0, x1);
checkDemon(d2, x0, a0, x1);
}
Aggregations