Search in sources :

Example 1 with HordeScheduler

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);
}
Also used : RealVector(org.apache.commons.math3.linear.RealVector) ArrayRealVector(org.apache.commons.math3.linear.ArrayRealVector) Horde(nars.rl.horde.Horde) HordeScheduler(nars.rl.horde.HordeScheduler) ArrayRealVector(org.apache.commons.math3.linear.ArrayRealVector) Test(org.junit.jupiter.api.Test)

Aggregations

Horde (nars.rl.horde.Horde)1 HordeScheduler (nars.rl.horde.HordeScheduler)1 ArrayRealVector (org.apache.commons.math3.linear.ArrayRealVector)1 RealVector (org.apache.commons.math3.linear.RealVector)1 Test (org.junit.jupiter.api.Test)1