Search in sources :

Example 1 with FloatPolarNormalized

use of jcog.math.FloatPolarNormalized in project narchy by automenta.

the class DigitizedScalarTest method testRewardConceptsFuzzification3.

// @Test
// public void testRewardConceptsFuzzification1() {
// NAR d = new Default();
// MutableFloat m = new MutableFloat(0f);
// 
// testSteadyFreqCondition(m,
// new FuzzyScalarConcepts(
// new FloatNormalized(() -> m.floatValue()).updateRange(-1).updateRange(1),
// d, FuzzyScalarConcepts.FuzzyTriangle, $.p("x")),
// (f) -> Util.equals(f, 0.5f + 0.5f * m.floatValue(), tolerance)
// );
// }
@Disabled
@Test
public void testRewardConceptsFuzzification3() {
    NAR n = NARS.shell();
    MutableFloat m = new MutableFloat(0f);
    FloatNormalized range = new FloatPolarNormalized(() -> m.floatValue(), 1f);
    DigitizedScalar f = new DigitizedScalar(range, DigitizedScalar.FuzzyNeedle, n, $.p("low"), $.p("mid"), $.p("hih"));
    // {
    // f.clear();
    // m.setValue(0); d.next();
    // System.out.println(Texts.n4(m.floatValue()) + "\t" + f.toString());
    // assertEquals("(I-->[sad]) %0.25;.90%\t(I-->[neutral]) %1.0;.90%\t(I-->[happy]) %0.0;.90%", f.toString());
    // }
    // 
    // {
    // f.clear();
    // m.setValue(-1); d.next();
    // System.out.println(Texts.n4(m.floatValue()) + "\t" + f.toString());
    // assertEquals("(I-->[sad]) %1.0;.90%\t(I-->[neutral]) %0.0;.90%\t(I-->[happy]) %0.0;.90%", f.toString());
    // }
    // 
    // {
    // f.clear();
    // m.setValue(+1); d.next();
    // System.out.println(Texts.n4(m.floatValue()) + "\t" + f.toString());
    // assertEquals("(I-->[sad]) %0.0;.90%\t(I-->[neutral]) %0.0;.90%\t(I-->[happy]) %1.0;.90%", f.toString());
    // }
    testSteadyFreqCondition(m, f, (freqSum) -> {
        System.out.println(freqSum + " " + tolerance);
        return Util.equals(freqSum, 1f, tolerance);
    }, n);
}
Also used : FloatNormalized(jcog.math.FloatNormalized) MutableFloat(org.apache.commons.lang3.mutable.MutableFloat) DigitizedScalar(nars.concept.scalar.DigitizedScalar) FloatPolarNormalized(jcog.math.FloatPolarNormalized) NAR(nars.NAR) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

FloatNormalized (jcog.math.FloatNormalized)1 FloatPolarNormalized (jcog.math.FloatPolarNormalized)1 NAR (nars.NAR)1 DigitizedScalar (nars.concept.scalar.DigitizedScalar)1 MutableFloat (org.apache.commons.lang3.mutable.MutableFloat)1 Disabled (org.junit.jupiter.api.Disabled)1 Test (org.junit.jupiter.api.Test)1