use of nars.concept.TaskConcept in project narchy by automenta.
the class DynamicTruthBeliefTableTest method testDynamicConjunction3.
@Test
public void testDynamicConjunction3() throws Narsese.NarseseException {
NAR n = NARS.tmp();
n.believe("a:x", 1f, 0.9f);
n.believe("a:y", 1f, 0.9f);
n.believe("a:z", 1f, 0.9f);
n.run(1);
TaskConcept cc = (TaskConcept) n.conceptualize($("(&&, a:x, a:y, a:z)"));
Truth now = n.beliefTruth(cc, n.time());
assertNotNull(now);
assertTrue($.t(1f, 0.73f).equals(now, 0.1f), now + " truth at " + n.time());
// the truth values were provided despite the belief tables being empty:
// test unknown:
{
TaskConcept ccn = (TaskConcept) n.conceptualize($("(&&, a:x, a:w)"));
Truth nown = n.beliefTruth(ccn, n.time());
assertNull(nown);
}
// test negation:
Concept ccn = n.conceptualize($("(&&, a:x, (--, a:y), a:z)"));
{
Task t = n.belief(ccn.term());
assertNotNull(t);
// the critical component
assertEquals($("a:y"), t.term());
assertEquals(1f, t.freq());
}
assertTrue(ccn instanceof TaskConcept);
Truth nown = n.beliefTruth(ccn, n.time());
assertEquals("%0.0;.90%", nown.toString());
n.clear();
// test change after a component's revision to negate the input freq
n.believe("a:y", 0, 0.95f);
n.run(1);
n.concept("a:y").print();
Task ay = n.belief($$("a:y"));
assertTrue(ay.freq() < 0.5f);
Task bb = n.belief(n.conceptualize($("(&&, a:x, a:y, a:z)")), n.time());
Truth now2 = bb.truth();
assertTrue(now2.freq() < 0.4f);
}
Aggregations