Search in sources :

Example 1 with MultiOutputStream

use of jcog.data.MultiOutputStream in project narchy by automenta.

the class NARTestOptimize method main.

public static void main(String[] args) {
    PrintStream out = System.out;
    OutputStream fout = null;
    try {
        fout = new FileOutputStream(new File("/tmp/" + NARTestOptimize.class.getSimpleName() + ".csv"));
        System.setOut(new PrintStream(new MultiOutputStream(out, fout)));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    while (true) {
        Result<NAR> r = new Tweaks<>(() -> {
            NAR n = NARS.tmp();
            return n;
        }) {

            @Override
            protected boolean includeField(Field f) {
                return !f.getName().equals("DEBUG");
            }

            final Set<Class> exclude = Set.of(NARLoop.class);

            @Override
            protected boolean includeClass(Class<?> targetType) {
                return !exclude.contains(targetType);
            }
        }.learn().tweak("PERCEIVE", -1f, +1f, 0.25f, (NAR n, float p) -> n.emotion.want(MetaGoal.Perceive, p)).tweak("BELIEVE", -1f, +1f, 0.25f, (NAR n, float p) -> n.emotion.want(MetaGoal.Believe, p)).optimize(32 * 1024, 4, (n) -> tests(n, NAL1Test.class, NAL1MultistepTest.class, NAL2Test.class, NAL3Test.class, NAL5Test.class));
        r.print();
        r.tree(2, 8).print();
        System.out.println();
    }
}
Also used : NAL2Test(nars.nal.nal2.NAL2Test) Set(java.util.Set) MultiOutputStream(jcog.data.MultiOutputStream) NAL1MultistepTest(nars.nal.nal1.NAL1MultistepTest) MultiOutputStream(jcog.data.MultiOutputStream) Field(java.lang.reflect.Field) NAL1Test(nars.nal.nal1.NAL1Test) Tweaks(jcog.optimize.Tweaks) NARLoop(nars.NARLoop) NAL3Test(nars.nal.nal3.NAL3Test) NAL5Test(nars.nal.nal5.NAL5Test) NAR(nars.NAR)

Aggregations

Field (java.lang.reflect.Field)1 Set (java.util.Set)1 MultiOutputStream (jcog.data.MultiOutputStream)1 Tweaks (jcog.optimize.Tweaks)1 NAR (nars.NAR)1 NARLoop (nars.NARLoop)1 NAL1MultistepTest (nars.nal.nal1.NAL1MultistepTest)1 NAL1Test (nars.nal.nal1.NAL1Test)1 NAL2Test (nars.nal.nal2.NAL2Test)1 NAL3Test (nars.nal.nal3.NAL3Test)1 NAL5Test (nars.nal.nal5.NAL5Test)1