Search in sources :

Example 11 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL5Test method conditional_induction0NegBoth.

@Test
public void conditional_induction0NegBoth() {
    TestNAR tester = test;
    tester.believe("--((&&,x1,x2,a) ==> c)");
    tester.believe("--((&&,y1,y2,a) ==> c)");
    tester.mustBelieve(cycles, "((x1&&x2) ==> (y1&&y2))", 1.00f, 0.45f);
    tester.mustBelieve(cycles, "((y1&&y2) ==> (x1&&x2))", 1.00f, 0.45f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 12 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL5Test method deduction.

@Test
public void deduction() {
    TestNAR tester = test;
    // .en("If robin is a type of bird then robin is a type of animal.");
    tester.believe("<<robin --> bird> ==> <robin --> animal>>");
    // .en("If robin can fly then robin is a type of bird.");
    tester.believe("<<robin --> [flying]> ==> <robin --> bird>>");
    // .en("If robin can fly then robin is a type of animal.");
    tester.mustBelieve(cycles, "<<robin --> [flying]> ==> <robin --> animal>>", 1.00f, 0.81f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 13 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL5Test method conditional_deduction3.

@Test
public void conditional_deduction3() {
    TestNAR tester = test;
    // .en("If robin is a bird and it's living, then robin is an animal");
    tester.believe("<(&&,<robin --> bird>,<robin --> [living]>) ==> <robin --> animal>>");
    // .en("If robin can fly, then robin is a bird");
    tester.believe("<<robin --> [flying]> ==> <robin --> bird>>");
    // .en("If robin is living and it can fly, then robin is an animal.");
    tester.mustBelieve(cycles * 2, " <(&&,<robin --> [flying]>,<robin --> [living]>) ==> <robin --> animal>>", 1.00f, 0.81f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 14 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL5Test method compound_decomposition_one_premise_neg.

@Test
public void compound_decomposition_one_premise_neg() {
    // freq 0 conjunction would not be decomposed
    TestNAR tester = test;
    // .en("Robin cannot be both a flyer and a swimmer.");
    tester.believe("(&&,<robin --> [flying]>,<robin --> swimmer>)", 0.0f, 0.9f);
    // .en("Robin cannot swim.");
    tester.mustNotOutput(cycles, "<robin --> swimmer>", BELIEF, ETERNAL);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 15 with TestNAR

use of nars.test.TestNAR in project narchy by automenta.

the class NAL5Test method contraposition1.

// @Disabled
// @Test
// public void negation2() throws nars.Narsese.NarseseException {
// 
// TestNAR tester = test;
// tester.believe("<robin --> [flying]>", 0.9f, 0.9f); //.en("Robin can fly.");
// tester.ask("(--,<robin --> [flying]>)"); //.en("Can robin fly or not?");
// tester.mustBelieve(cycles, "(--,<robin --> [flying]>)", 0.10f, 0.90f); //.en("It is unlikely that robin cannot fly.");
// 
// }
@Test
public void contraposition1() throws nars.Narsese.NarseseException {
    TestNAR tester = test;
    /*
        IN:   <(--,<robin --> bird>) ==> <robin --> [flying]>>. %0.1%
                      // It is unlikely that if robin is not a type of bird then robin can fly.
        IN:   <(--,<robin --> [flying]>) ==> <robin --> bird>>?
                      // If robin cannot fly then is robin a type of bird?

         OUT: <(--,<robin --> [flying]>) ==> <robin --> bird>>. %0.00;0.45%
                      // I guess it is unlikely that if robin cannot fly then robin is a type of bird.
         */
    // .en("It is unlikely that if robin is not a type of bird then robin can fly.");
    tester.believe("<(--,<robin --> bird>) ==> <robin --> [flying]>>", 0.1f, 0.9f);
    // .en("If robin cannot fly then is robin a type of bird ? ");
    tester.ask("<(--,<robin --> [flying]>) ==> <robin --> bird>>");
    // .en("I guess it is unlikely that if robin cannot fly then robin is a type of bird.");
    tester.mustBelieve(cycles, " <(--,<robin --> [flying]>) ==> <robin --> bird>>", 0f, 0.45f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Aggregations

TestNAR (nars.test.TestNAR)178 Test (org.junit.jupiter.api.Test)169 NALTest (nars.util.NALTest)162 NAL7Test (nars.nal.nal7.NAL7Test)18 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)11 Disabled (org.junit.jupiter.api.Disabled)5 NAR (nars.NAR)2 Concept (nars.concept.Concept)2 DoubleSummaryStatistics (java.util.DoubleSummaryStatistics)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 BiFunction (java.util.function.BiFunction)1 IntFunction (java.util.function.IntFunction)1 nars (nars)1 NARS (nars.NARS)1 TaskStatistics (nars.task.util.TaskStatistics)1 Term (nars.term.Term)1 DeductiveMeshTest (nars.test.DeductiveMeshTest)1 ETERNAL (nars.time.Tense.ETERNAL)1 NotNull (org.jetbrains.annotations.NotNull)1 Assertions.assertNotEquals (org.junit.jupiter.api.Assertions.assertNotEquals)1