Search in sources :

Example 96 with TestNAR

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

the class NAL4MultistepTest method nal4_everyday_reasoning.

@Test
public void nal4_everyday_reasoning() {
    int time = 3500;
    // Global.DEBUG = true;
    TestNAR tester = test;
    tester.nar.freqResolution.set(0.1f);
    // tester.log();
    // (({tom},{sky})-->likes).  <{tom} --> cat>. <({tom},{sky}) --> likes>. <(cat,[blue]) --> likes>?
    // en("the sky is blue");
    tester.input("<{sky} --> [blue]>.");
    // en("tom is a cat");
    tester.input("<{tom} --> cat>.");
    // en("tom likes the sky");
    tester.input("likes({tom},{sky}).");
    // cats like blue?
    tester.input("$0.9 likes(cat,[blue])?");
    // return mustOutput(cycleStart, cycleEnd, sentenceTerm, punc, freqMin, freqMax, confMin, confMax, occTimeAbsolute, occTimeAbsolute);
    tester.mustBelieve(time, "likes(cat,[blue])", 1f, 0.16F);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 97 with TestNAR

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

the class NAL4MultistepTest method nal4_everyday_reasoning_easier.

@Test
@Disabled
public void nal4_everyday_reasoning_easier() throws Narsese.NarseseException {
    int time = 2550;
    // Global.DEBUG = true;
    TestNAR tester = test;
    // tester.nar.log();
    // en("the sky is blue");
    tester.believe("<sky --> blue>", 1.0f, 0.9f);
    // en("tom is a cat");
    tester.believe("<tom --> cat>", 1.0f, 0.9f);
    // en("tom likes the sky");
    tester.believe("<(tom,sky) --> likes>", 1.0f, 0.9f);
    // cats like blue?
    tester.ask("<(cat,blue) --> likes>");
    // tester.askAt(time/3, "<(cat,blue) --> likes>"); //cats like blue?
    // tester.askAt(time/2, "<(cat,blue) --> likes>"); //cats like blue?
    // en("A base is something that has a reaction with an acid.");
    tester.mustBelieve(time, "<(cat,blue) --> likes>", 1.0f, 0.42f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest) Disabled(org.junit.jupiter.api.Disabled)

Example 98 with TestNAR

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

the class NAL5Test method conditional_induction0.

@Test
public void conditional_induction0() {
    // //((&&,M,A..+) ==> C), ((&&,B,A..+)==>C)   |- (B ==>+- M), (Belief:Induction)
    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 99 with TestNAR

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

the class NAL5Test method abduction.

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

Example 100 with TestNAR

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

the class NAL5Test method conditional_induction0SimpleDepVar2.

@Test
public void conditional_induction0SimpleDepVar2() {
    TestNAR tester = test;
    tester.believe("((&&,x1,#1) ==> (a && #1))");
    tester.believe("((&&,y1,#1) ==> (a && #1))");
    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