Search in sources :

Example 6 with NARSwing

use of nars.gui.NARSwing in project opennars by opennars.

the class RasterHierachy method main.

public static void main(String[] args) {
    // RasterHierarchy rh = new RasterHierarchy(8, 640, 480, 12, 2);
    // RasterHierarchy rh = new RasterHierarchy(3, 640, 480, 5, 2);
    nar = new NAR();
    nar.param.noiseLevel.set(0);
    NARSwing.themeInvert();
    NARSwing swing = new NARSwing(nar);
    // nar.start(0);
    // new RasterHierachy(3, 640, 480, 8, 3);
    RasterHierachy rh = new RasterHierachy(3, 640, 480, 5, 3);
    rh.process();
}
Also used : NARSwing(nars.gui.NARSwing) NAR(nars.main.NAR)

Example 7 with NARSwing

use of nars.gui.NARSwing in project opennars by opennars.

the class SupervisedRecognition method main.

public static void main(String[] args) {
    HashMap<String, Integer> map = new HashMap<>();
    // ONES:
    map.put("oxooo" + "\n" + "xxooo" + "\n" + "oxooo" + "\n" + "oxooo" + "\n" + "oxooo" + "\n", 1);
    map.put("oxxoo" + "\n" + "xoxoo" + "\n" + "ooxoo" + "\n" + "ooxoo" + "\n" + "ooxoo" + "\n", 1);
    map.put("oooxo" + "\n" + "ooxxo" + "\n" + "oooxo" + "\n" + "oooxo" + "\n" + "oooxo" + "\n", 1);
    map.put("oooox" + "\n" + "oooxx" + "\n" + "oooox" + "\n" + "oooox" + "\n" + "oooox" + "\n", 1);
    // ZEROS:
    map.put("ooooo" + "\n" + "xxxxx" + "\n" + "xooox" + "\n" + "xooox" + "\n" + "xxxxx" + "\n", 0);
    map.put("xxxxx" + "\n" + "xooox" + "\n" + "xooox" + "\n" + "xooox" + "\n" + "xxxxx" + "\n", 0);
    map.put("ooooo" + "\n" + "ooooo" + "\n" + "xxxxx" + "\n" + "xooox" + "\n" + "xxxxx" + "\n", 0);
    map.put("ooooo" + "\n" + "oxxxx" + "\n" + "oxoox" + "\n" + "oxoox" + "\n" + "oxxxx" + "\n", 0);
    map.put("ooooo" + "\n" + "xxxxx" + "\n" + "xooox" + "\n" + "xooox" + "\n" + "xxxxx" + "\n", 0);
    // training phase:
    NAR nar = new NAR();
    NARSwing.themeInvert();
    new NARSwing(nar);
    nar.param.noiseLevel.set(0);
    for (String example : map.keySet()) {
        int solution = map.get(example);
        inputExample(nar, example, solution);
        nar.cycles(1000);
    }
    // Test phase:
    inputExample(nar, "ooxoo" + "\n" + "ooxoo" + "\n" + "ooxoo" + "\n" + "ooxoo" + "\n" + "ooxoo" + "\n", -1);
    try {
        nar.askNow("<?what --> EXAMPLE>", new AnswerHandler() {

            @Override
            public void onSolution(Sentence belief) {
                System.out.println(belief);
            }
        });
    } catch (Narsese.InvalidInputException ex) {
    }
    nar.cycles(100000);
}
Also used : HashMap(java.util.HashMap) NARSwing(nars.gui.NARSwing) Narsese(nars.io.Narsese) Sentence(nars.entity.Sentence) NAR(nars.main.NAR) AnswerHandler(nars.io.events.AnswerHandler)

Example 8 with NARSwing

use of nars.gui.NARSwing in project opennars by opennars.

the class TestChamber method main.

public static void main(String[] args) {
    // set NAR architecture parameters:
    // builder...
    // not that much events in testchamber anyway
    Parameters.CONSIDER_NEW_OPERATION_BIAS = 1.0f;
    // but many possible different ways to achieve certain things
    Parameters.SEQUENCE_BAG_SIZE = 100;
    NAR nar = new NAR();
    nar.param.decisionThreshold.set(0.51);
    // set NAR runtime parmeters:
    /*for(NAR.PluginState pluginstate : nar.getPlugins()) {
            if(pluginstate.plugin instanceof InternalExperience || pluginstate.plugin instanceof FullInternalExperience) {
                nar.removePlugin(pluginstate);
            }
        }*/
    // nar.addPlugin(new TemporalParticlePlanner());
    // (nar.param).duration.set(10);
    (nar.param).noiseLevel.set(0);
    new NARSwing(nar);
    new TestChamber(nar);
    nar.start(narUpdatePeriod);
}
Also used : NARSwing(nars.gui.NARSwing) NAR(nars.main.NAR)

Example 9 with NARSwing

use of nars.gui.NARSwing in project opennars by opennars.

the class Launcher method jButton1ActionPerformed.

// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_jButton1ActionPerformed
    NARSwing sw = new NARSwing(new NAR());
    this.dispose();
}
Also used : NARSwing(nars.gui.NARSwing) NAR(nars.main.NAR)

Aggregations

NARSwing (nars.gui.NARSwing)9 NAR (nars.main.NAR)8 Sentence (nars.entity.Sentence)4 AnswerHandler (nars.io.events.AnswerHandler)4 NWindow (automenta.vivisect.swing.NWindow)3 PCanvas (automenta.vivisect.swing.PCanvas)2 LineChart (automenta.vivisect.timeline.LineChart)2 TimelineVis (automenta.vivisect.timeline.TimelineVis)2 Narsese (nars.io.Narsese)2 TreeMLData (automenta.vivisect.TreeMLData)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Random (java.util.Random)1 DerivationContext (nars.control.DerivationContext)1 TaskImmediateProcess (nars.core.Events.TaskImmediateProcess)1 NAR (nars.core.NAR)1 NAL (nars.cycle.NAL)1 Task (nars.entity.Task)1 KeyboardInputPanel (nars.gui.input.KeyboardInputPanel)1 ChangedTextInput (nars.io.ChangedTextInput)1