Search in sources :

Example 36 with TestNAR

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

the class NAL6Test method variable_introduction.

// @Test
// public void testBeliefToEquivalence() {
// 
// TestNAR tester = test;
// tester.believe("<<$1 --> bird> ==> <$1 --> swimmer>>", 1f, 0.9f); //en("I guess a bird is usually a swimmer.");
// tester.believe("<<$1 --> swimmer> ==> <$1 --> bird>>", 1f, 0.9f); //en("I guess a bird is usually a swimmer.");
// tester.mustBelieve(cycles, "<<$1 --> swimmer> <=> <$1 --> bird>>", 1.00f, 0.81f); //en("I guess a swimmer is a bird.");
// }
@Test
public void variable_introduction() {
    TestNAR tester = test;
    // en("A swan is a bird.");
    tester.believe("<swan --> bird>");
    // en("A swan is usually a swimmer.");
    tester.believe("<swan --> swimmer>", 0.80f, 0.9f);
    // en("I guess a swimmer is a bird.");
    tester.mustBelieve(cycles, "<<$1 --> swimmer> ==> <$1 --> bird>>", 1.00f, 0.39f);
    // en("I guess a bird is usually a swimmer.");
    tester.mustBelieve(cycles, "<<$1 --> bird> ==> <$1 --> swimmer>>", 0.80f, 0.45f);
    // tester.mustBelieve(cycles, "<<$1 --> swimmer> <=> <$1 --> bird>>", 0.80f, 0.45f); //en("I guess a bird is usually a swimmer, and the other way around.");
    // en("Some bird can swim.");
    tester.mustBelieve(cycles, "(&&, <#1 --> swimmer>, <#1 --> bird>)", 0.80f, 0.81f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 37 with TestNAR

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

the class NAL6Test method second_level_variable_unification.

@Test
public void second_level_variable_unification() {
    TestNAR tester = test;
    // en("there is a lock which is opened by all keys");
    tester.believe("(((#1 --> lock) && ($2 --> key)) ==> open($2, #1))", 1.00f, 0.90f);
    // en("key1 is a key");
    tester.believe("({key1} --> key)", 1.00f, 0.90f);
    // en("there is a lock which is opened by key1");
    tester.mustBelieve(cycles, "((#1 --> lock) && open({key1}, #1))", 1.00f, 0.81f);
}
Also used : TestNAR(nars.test.TestNAR) Test(org.junit.jupiter.api.Test) NALTest(nars.util.NALTest)

Example 38 with TestNAR

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

the class NAL6Test method strong_unification_simple.

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

Example 39 with TestNAR

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

the class NAL6Test method impliesUnbelievedYet.

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

Example 40 with TestNAR

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

the class NAL6Test method variable_elimination_conj.

// @Test
// public void variable_elimination3() {
// 
// TestNAR tester = test;
// tester.believe("<<$x --> animal> <=> <$x --> bird>>"); //en("Something is a animal if and only if it is a bird.");
// tester.believe("<robin --> bird>"); //en("A robin is a bird.");
// tester.mustBelieve(cycles, "<robin --> animal>", 1.00f, 0.45f /*0.81f*/); //en("A robin is a animal.");
// 
// }
@Test
public void variable_elimination_conj() {
    TestNAR tester = test;
    // en("Some bird can swim.");
    tester.believe("(&&,<#x --> bird>,<#x --> swimmer>)");
    // en("Swan is a type of bird.");
    tester.believe("<swan --> bird>", 0.90f, 0.9f);
    // en("I guess swan can swim.");
    tester.mustBelieve(// en("I guess swan can swim.");
    cycles, // en("I guess swan can swim.");
    "<swan --> swimmer>", // en("I guess swan can swim.");
    0.90f, 0.43f);
}
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