Search in sources :

Example 31 with TestNAR

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

the class NAL6Test method multiple_variable_elimination3.

@Test
public void multiple_variable_elimination3() {
    TestNAR tester = test;
    // en("There is a lock that can be opened by every key.");
    tester.believe("(&&,<#x --> lock>,(<$y --> key> ==> open($y,#x)))");
    // en("Lock-1 is a lock.");
    tester.believe("<{lock1} --> lock>");
    tester.mustBelieve(cycles * 2, "<<$1 --> key> ==> open($1,{lock1})>", 1.00f, 0.73f);
// 0.43f); //en("I guess Lock-1 can be opened by every key.");
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 32 with TestNAR

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

the class NAL6Test method variable_introduction_with_existing_vars2.

@Test
public void variable_introduction_with_existing_vars2() {
    // test that an introduced variable doesn't interfere with an existing variable of same name ($1)
    TestNAR tester = test;
    // 
    // en("A gull is a swimmer.");
    tester.believe("<#1 --> swimmer>");
    // en("Usually, a swan is a swimmer.");
    tester.believe("<swan --> swimmer>", 0.80f, 0.9f);
    // en("I guess what can be said about gull usually can also be said about swan.");
    tester.mustBelieve(cycles, "<<#1 --> $2> ==> <swan --> $2>>", 0.80f, 0.45f);
    // en("I guess what can be said about swan can also be said about gull.");
    tester.mustBelieve(cycles, "<<swan --> $1> ==> <#2 --> $1>>", 1.00f, 0.39f);
    // tester.mustBelieve(cycles, "<<#1 --> $2> <=> <swan --> $2>>", 0.80f, 0.45f); //en("I guess gull and swan share most properties.");
    // en("Gull and swan have some common property.");
    tester.mustBelieve(cycles, "(&&,<#1 --> #2>,<swan --> #2>)", 0.80f, 0.81f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 33 with TestNAR

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

the class NAL6Test method strong_unification_neg.

// see discussion on https://groups.google.com/forum/#!topic/open-nars/1TmvmQx2hMk
@Test
public void strong_unification_neg() {
    TestNAR tester = test;
    tester.believe("( --sentence($a,is,$b) ==> ($a --> $b) )", 1.00f, 0.90f);
    tester.believe("sentence(bmw,is,car)", 0.00f, 0.90f);
    // en("there is a lock which is opened by key1");
    tester.mustBelieve(cycles, "car:bmw", 1.00f, 0.81f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 34 with TestNAR

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

the class NAL6Test method variable_unification3.

@Test
public void variable_unification3() {
    TestNAR tester = test;
    Param.DEBUG = true;
    tester.log();
    // en("If something is a swan, then it is a bird.");
    tester.believe("<<$x --> swan> ==> <$x --> bird>>", 1.00f, 0.80f);
    // en("If something is a swan, then it is a swimmer.");
    tester.believe("<<$y --> swan> ==> <$y --> swimmer>>", 0.80f, 0.9f);
    // en("I believe that if something is a swan, then usually, it is both a bird and a swimmer.");
    tester.mustBelieve(cycles, "<<$1 --> swan> ==> (&&,<$1 --> bird>,<$1 --> swimmer>)>", 0.80f, 0.72f);
    // en("I guess if something is a swimmer, then it is a bird.");
    tester.mustBelieve(cycles, "<<$1 --> swimmer> ==> <$1 --> bird>>", 1f, 0.37f);
    // en("I guess if something is a bird, then it is a swimmer.");
    tester.mustBelieve(cycles, "<<$1 --> bird> ==> <$1 --> swimmer>>", 0.80f, 0.42f);
// tester.mustBelieve(cycles, "<<$1 --> bird> <=> <$1 --> swimmer>>", 0.80f, 0.42f); //en("I guess something is a bird, if and only if it is a swimmer.");
// tester.mustBelieve(cycles, "<<$1 --> swan> ==> (&&,(--,<$1 --> bird>),(--,<$1 --> swimmer>))>", 0.00f, 0.72f); //en("I believe that if something is a swan, then it is a bird or a swimmer.");
// technicallt this is the same as:
// tester.mustBelieve(cycles, "<<$1 --> swan> ==> (||,<$1 --> bird>,<$1 --> swimmer>)>", 1.00f, 0.72f); //en("I believe that if something is a swan, then it is a bird or a swimmer.");
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 35 with TestNAR

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

the class NAL6Test method strong_unification_pos.

// see discussion on https://groups.google.com/forum/#!topic/open-nars/1TmvmQx2hMk
@Test
public void strong_unification_pos() {
    TestNAR tester = test;
    tester.believe("(sentence($a,is,$b) ==> ($a --> $b))", 1.00f, 0.90f);
    tester.believe("sentence(bmw,is,car)", 1.00f, 0.90f);
    // en("there is a lock which is opened by key1");
    tester.mustBelieve(cycles, "car:bmw", 1.00f, 0.81f);
}
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