Search in sources :

Example 1 with TestNAR

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

the class NAL4MultistepTest method nal4_everyday_reasoning_easiest.

@Test
public void nal4_everyday_reasoning_easiest() throws Narsese.NarseseException {
    int time = 550;
    // Global.DEBUG = true;
    TestNAR tester = test;
    // en("the sky is blue");
    tester.believe("<sky --> blue>", 1.0f, 0.9f);
    // tester.believe("<tom --> cat>",1.0f,0.9f); //en("tom is a cat");
    // tester.believe("<(tom,sky) --> likes>",1.0f,0.9f); //en("tom likes the sky");
    // en("tom likes the sky");
    tester.believe("<sky --> likes>", 1.0f, 0.9f);
    // tester.ask("<(cat,blue) --> likes>"); //cats like blue?
    // tester.askAt(time/3, "<(cat,blue) --> likes>"); //cats like blue?
    // tester.askAt(time/2, "<(cat,blue) --> likes>"); //cats like blue?
    // cats like blue?
    tester.ask("<blue --> likes>");
    // tester.mustBelieve(time, "<(cat,blue) --> likes>", 1.0f, 0.42f);
    tester.mustBelieve(time, "<blue --> likes>", 1.0f, 0.4f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 2 with TestNAR

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

the class NAL5Test method induction.

@Test
public void induction() {
    /*
         <<robin --> bird> ==> <robin --> animal>>. // If robin is a type of bird then robin is a type of animal.
         <<robin --> [flying]> ==> <robin --> animal>>. %0.8%  // If robin can fly then robin is probably a type of animal.
         OUT: <<robin --> bird> ==> <robin --> [flying]>>. %1.00;0.39% // I guess if robin is a type of bird then robin can fly.
         OUT: <<robin --> [flying]> ==> <robin --> bird>>. %0.80;0.45% // I guess if robin can fly then robin is a type of bird.
         */
    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 probably a type of animal.");
    tester.believe("<<robin --> [flying]> ==> <robin --> animal>>", 0.8f, 0.9f);
    // .en("I guess if robin is a type of bird then robin can fly.");
    tester.mustBelieve(cycles, "<<robin --> bird> ==> <robin --> [flying]>>", 1.00f, 0.39f);
    // .en("I guess if robin can fly then robin is a type of bird.");
    tester.mustBelieve(cycles, "<<robin --> [flying]> ==> <robin --> bird>>", 0.80f, 0.45f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 3 with TestNAR

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

the class NAL5Test method compound_composition_Subj.

@Test
public void compound_composition_Subj() {
    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 animal.");
    tester.believe("<<robin --> [flying]> ==> <robin --> animal>>", 0.9f, 0.81f);
    // .en("If robin can fly and is a type of bird then robin is a type of animal.");
    tester.mustBelieve(cycles, " <(&&,<robin --> bird>, <robin --> [flying]>) ==> <robin --> animal>>", 0.9f, 0.73f);
// tester.mustBelieve(cycles," <(||,<robin --> bird>, <robin --> [flying]>) ==> <robin --> animal>>",0.9f /*1f ? */,0.73f); //.en("If robin can fly or is a type of bird then robin is a type of animal.");
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 4 with TestNAR

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

the class NAL5Test method conditional_abduction3.

@Test
public void conditional_abduction3() {
    TestNAR tester = test;
    // .en("If robin can fly and it has wings, then robin is living.");
    tester.believe("<(&&,<robin --> [flying]>,<robin --> [withWings]>) ==> <robin --> [living]>>", 0.9f, 0.9f);
    // .en("If robin can fly and robin is a bird then robin is living.");
    tester.believe("<(&&,<robin --> [flying]>,<robin --> bird>) ==> <robin --> [living]>>");
    tester.mustBelieve(cycles * 2, "<<robin --> bird> ==> <robin --> [withWings]>>", // 0.90f,0.45f);
    1.00f, // .en("I guess if robin is a bird, then robin has wings.");
    0.42f);
    tester.mustBelieve(cycles * 2, "<<robin --> [withWings]> ==> <robin --> bird>>", 0.90f, // .en("I guess if robin has wings, then robin is a bird.");
    0.45f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 5 with TestNAR

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

the class NAL5Test method conditional_induction0Simple.

@Test
public void conditional_induction0Simple() {
    TestNAR tester = test;
    tester.believe("((&&,x1,a) ==> c)");
    tester.believe("((&&,y1,a) ==> c)");
    tester.mustBelieve(cycles, "(x1 ==> y1)", 1.00f, 0.45f);
    tester.mustBelieve(cycles, "(y1 ==> x1)", 1.00f, 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