use of nars.test.TestNAR in project narchy by automenta.
the class NAL7Test method induction_on_events_composition_post.
@ValueSource(ints = { 0, 1, 2, 3, 4 })
@ParameterizedTest
public void induction_on_events_composition_post(int dt) {
TestNAR tester = test;
int t = 0;
String component = "(open(John,door) &| hold(John,key))";
tester.inputAt(t, component + ". :|:");
tester.inputAt(t + dt, "enter(John,room). :|:");
tester.mustBelieve((2 * (t + Math.max(2, dt)) + Math.max(2, dt) + 1), /**
* approx
*/
"(" + component + " ==>+" + dt + " enter(John,room))", 1.00f, 0.45f, t);
}
use of nars.test.TestNAR in project narchy by automenta.
the class NAL7Test method testPrediction1.
@Test
public void testPrediction1() throws Narsese.NarseseException {
int eventDT = 16;
int cycles = 10;
TestNAR t = test;
// ((FrameTime)t.nar.time).dur(eventDT);
t.dur(eventDT / 2);
// t.nar.onTask((tt)->{
// if (tt.start() > t.nar.time()) {
// System.out.println(tt.proof());
// }
// });
int x = 0;
for (int i = 0; i < cycles; i++) {
if (i == cycles - 1) {
$.task($("(y)"), QUESTION, null).time(0, x, x + 2 * eventDT).setPriThen(1f).apply(t.nar);
}
t.inputAt(x, "(x). :|:").inputAt(x + eventDT, "(y). :|:");
x += 2 * eventDT;
}
int xx = x;
t.mustBelieve(x - 1, "(y)", 1f, 0.73f, (y) -> y >= xx && y <= (xx + eventDT));
}
use of nars.test.TestNAR in project narchy by automenta.
the class NAL7Test method temporal_explification.
@Test
public void temporal_explification() {
TestNAR tester = test;
tester.believe("(<($x, room) --> enter> ==>-5 <($x, door) --> open>)", 0.9f, 0.9f);
tester.believe("(<($y, door) --> open> ==>-5 <($y, key) --> hold>)", 0.8f, 0.9f);
tester.mustBelieve(cycles, "(<($1,key) --> hold> ==>+10 <($1,room) --> enter>)", 1.00f, 0.37f);
}
use of nars.test.TestNAR in project narchy by automenta.
the class LinkageTest method ProperlyLinkedIndirectlyLayer2Test.
// interlinked with an intermediate concept, this is needed in order to select one as task and the other as belief
public void ProperlyLinkedIndirectlyLayer2Test(@NotNull String premise1, @NotNull String premise2) throws Exception {
TestNAR tester = test;
// .en("If robin is a type of bird then robin can fly.");
tester.believe(premise1);
// .en("Robin is a type of bird.");
tester.believe(premise2);
tester.nar.run(1);
boolean passed = links(premise1, premise2, tester);
boolean passed2 = links(premise2, premise1, tester);
assertTrue(passed);
assertTrue(passed2);
// dummy
tester.believe("<a --> b>");
tester.mustBelieve(1, "<a --> b>", 0.9f);
}
use of nars.test.TestNAR in project narchy by automenta.
the class LinkageTest method ProperlyLinkedTest.
void ProperlyLinkedTest(@NotNull String premise1, @NotNull String premise2) throws Exception {
test.requireConditions = false;
TestNAR tester = test;
// .en("If robin is a type of bird then robin can fly.");
tester.believe(premise1);
// .en("Robin is a type of bird.");
tester.believe(premise2);
tester.run(runCycles, false);
Concept ret = tester.nar.conceptualize(premise1);
assertTrue(isPassed2(premise2, ret), ret + " termlinks contains " + premise2);
Concept ret2 = tester.nar.conceptualize(premise2);
assertTrue(isPassed2(premise1, ret2), ret2 + " termlinks contains " + premise1);
}
Aggregations