Giter VIP home page Giter VIP logo

narjure's Introduction

OpenNARS Logo Open-NARS is the open-source version of NARS, a general-purpose AI system, designed in the framework of a reasoning system. This project is an evolution of the v1.5 system. The mailing list discusses both its theory and implementation.

Build Status codecov Codacy Badge

How to build OpenNARS

Using mvn:

for each of the projects:

https://github.com/opennars/opennars-parent.git     
https://github.com/opennars/opennars.git     
https://github.com/opennars/opennars-lab.git     
https://github.com/opennars/opennars-applications.git     
https://github.com/opennars/opennars-gui.git

git clone 'project'
cd 'project_dir'
mvn clean install 

optionally append -Dmaven.javadoc.skip=true to skip documentation generation

cd 'project_dir'
mvn exec:java

Alternatively, using IntelliJ IDE:

Install git https://git-scm.com/downloads

Install OpenJDK 11 https://jdk.java.net/11/

Install community edition IntelliJ https://www.jetbrains.com/idea/download/

Checkout https://github.com/opennars/opennars.git

Checkout https://github.com/opennars/opennars-lab.git

Checkout https://github.com/opennars/opennars-applications.git

You can either checkout within Intellij or use the Github desktop (available from the github clone button in the repo)

Build opennars

If this is a fresh install you will be prompted to enter the jdk path (where you installed it above) You may be prompted to update maven dependencies - do this if prompted

Build opennars-lab

Select org.opennars.lab.launcher.Launcher as the main entry point

Build opennars-applications

Select org.opennars.applications.Launcher

Application Launchers

The launchers are the easiest way to run the various apps

opennars-lab

Main GUI - Main user interface for NARS

Test Chamber - Simulation environment for testing behaviours

Micro world	- Behaviour learning by simple insect like creature

NAR Pong - The classic pong game

Language Lab - For experimenting with parts of speech (POS) and grammar learning

Perception Test - Pattern matching experiment

Prediction Test - Predicts a waveform - Can be run directly from Intellij (Current issue with running with launcher)

Vision - Vision experiment - Can be run direcly from Intellij (Current issue with running with launcher)

opennars-applications

Main GUI - A simple MIT license GUI

Crossing - A smart city traffic intersection simulation

Identity mapping - An experimental setup for testing aspects of Relations Frame Theory (RFT)

Opennars Core is run directly by the Lab and Applications Launchers.

Example Narsese files

Here is a link to some Narses examples including:

Toothbrush example - how to use a toothbrush to undo a screw?

Detective example - who is the criminal?

https://github.com/opennars/opennars/tree/master/src/main/resources/nal/application

Theory Overview

Non-Axiomatic Reasoning System (NARS) processes tasks imposed by its environment, which may include human users or other computer systems. Tasks can arrive at any time, and there is no restriction on their contents as far as they can be expressed in Narsese, the I/O language of NARS.

There are several types of tasks:

  • Judgment - To process it means to accept it as the system's belief, as well as to derive new beliefs and to revise old beliefs accordingly.
  • Question - To process it means to find the best answer to it according to current beliefs.
  • Goal - To process it means to carry out some system operations to realize it.

As a reasoning system, the architecture of NARS consists of a memory, an inference engine, and a control mechanism.

The memory contains a collection of concepts, a list of operators, and a buffer for new tasks. Each concept is identified by a term, and contains tasks and beliefs directly on the term, as well as links to related tasks and terms.

The inference engine carries out various type of inference, according to a set of built-in rules. Each inference rule derives certain new tasks from a given task and a belief that are related to the same concept.

The control mechanism repeatedly carries out the working cycle of the system, generally consisting of the following steps:

  1. Select tasks in the buffer to insert into the corresponding concepts, which may include the creation of new concepts and beliefs, as well as direct processing on the tasks.
  2. Select a concept from the memory, then select a task and a belief from the concept.
  3. Feed the task and the belief to the inference engine to produce derived tasks.
  4. Add the derived tasks into the task buffer, and send report to the environment if a task provides a best-so-far answer to an input question, or indicates the realization of an input goal.
  5. Return the processed belief, task, and concept back to memory with feedback.

All the selections in steps 1 and 2 are probabilistic, in the sense that all the items (tasks, beliefs, or concepts) within the scope of the selection have priority values attached, and the probability for each of them to be selected at the current moment is proportional to its priority value. When an new item is produced, its priority value is determined according to its parent items, as well as the type of mechanism that produces it. At step 5, the priority values of all the involved items are adjusted, according to the immediate feedback of the current cycle.

At the current time, the most comprehensive description of NARS are the books Rigid Flexibility: The Logic of Intelligence and Non-Axiomatic Logic: A Model of Intelligent Reasoning . Various aspects of the system are introduced and discussed in many papers, most of which are available here.

Beginners can start at the following online materials:

Contents

  • core - reasoning engine
  • nal - examples/unit tests

The core is derived from the code of Pei Wang.

Run Requirements

  • Java 8+ (OpenJDK 10 recommended)

Example Files

For an overview of reasoning features, see working examples (tests) in the nal folder, also explained in SingleStepTestingCases and MultiStepExamples.

Development Requirements

  • Maven

Links

narjure's People

Contributors

0xc1c4da avatar jorisbontje avatar patham9 avatar ptrman avatar rasom avatar tonylo1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

narjure's Issues

Add input-load-reducer

This is slightly more problematic than derived-load-reducer as there may not be a budget available for the bag sort order.

Currently input budget is ignored by task-creator and default is assigned. maybe budget should be assigned at sentence parsing or input sensor?

Control Issue

The for example for Pong needed temporal hypotheses are not that complex, and altough they appear constantly, it is still extremely difficult for the control mechanism to find these.

Input events and goals need a higher default budget value for this to work better, but also the control system might need some tweaks.

Mailbox issue

We still don't have the message flow under control, how is it that 30 seconds after (stop) the system still processes messages and then stops?

We have to add a timer tick in load reducer as I suggested at first in order to control the messages forwarded to task dispatcher per time, else this won't change probably.

Can't compile master branch

Hello!
I've just pulled master branch and tried to compile the JAR library.
But I'm getting an error about too long file name. What am I missing?

> lein uberjar
Compiling narjure.actor.utils
16:52:48.301 [main] INFO  c.p.actors.ActorRegistry - Actor registry is co.paralleluniverse.actors.LocalActorRegistry@3e357bf9
Compiling narjure.core
Compiling narjure.perception-action.operator-executor
Compiling narjure.perception-action.sentence-parser
Compiling narjure.perception-action.task-creator
Compiling narjure.bag
Compiling narjure.defaults
Compiling narjure.repl
java.io.IOException: File name too long, compiling:(nal/core.clj:85:1)
Exception in thread "main" java.io.IOException: File name too long, compiling:(nal/core.clj:85:1)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6179)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6179)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.access$300(Compiler.java:38)
    at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:577)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
    at clojure.lang.Compiler.analyze(Compiler.java:6524)
    at clojure.lang.Compiler.analyze(Compiler.java:6485)
    at clojure.lang.Compiler.compile1(Compiler.java:7318)
    at clojure.lang.Compiler.compile(Compiler.java:7390)
    at clojure.lang.RT.compile(RT.java:399)
    at clojure.lang.RT.load(RT.java:444)
    at clojure.lang.RT.load(RT.java:412)
    at clojure.core$load$fn__5448.invoke(core.clj:5866)
    at clojure.core$load.doInvoke(core.clj:5865)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5671)
    at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
    at clojure.core$load_lib.doInvoke(core.clj:5710)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:632)
    at clojure.core$load_libs.doInvoke(core.clj:5749)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:632)
    at clojure.core$require.doInvoke(core.clj:5832)
    at clojure.lang.RestFn.invoke(RestFn.java:703)
    at narjure.repl$loading__5340__auto____9572.invoke(repl.clj:1)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3623)
    at clojure.lang.Compiler.compile1(Compiler.java:7323)
    at clojure.lang.Compiler.compile1(Compiler.java:7313)
    at clojure.lang.Compiler.compile(Compiler.java:7390)
    at clojure.lang.RT.compile(RT.java:399)
    at clojure.lang.RT.load(RT.java:444)
    at clojure.lang.RT.load(RT.java:412)
    at clojure.core$load$fn__5448.invoke(core.clj:5866)
    at clojure.core$load.doInvoke(core.clj:5865)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5671)
    at clojure.core$compile$fn__5453.invoke(core.clj:5877)
    at clojure.core$compile.invoke(core.clj:5876)
    at user$eval20$fn__29.invoke(form-init2503987674567170652.clj:1)
    at user$eval20.invoke(form-init2503987674567170652.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6782)
    at clojure.lang.Compiler.eval(Compiler.java:6772)
    at clojure.lang.Compiler.eval(Compiler.java:6772)
    at clojure.lang.Compiler.load(Compiler.java:7227)
    at clojure.lang.Compiler.loadFile(Compiler.java:7165)
    at clojure.main$load_script.invoke(main.clj:275)
    at clojure.main$init_opt.invoke(main.clj:280)
    at clojure.main$initialize.invoke(main.clj:308)
    at clojure.main$null_opt.invoke(main.clj:343)
    at clojure.main$main.doInvoke(main.clj:421)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.io.IOException: File name too long
    at java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.io.File.createNewFile(File.java:1006)
    at clojure.lang.Compiler.writeClassFile(Compiler.java:7263)
    at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4531)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3983)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
    ... 395 more
Compilation failed: Subprocess failed

Truth/Desire Function argument swapping for swapped rules.

As we know from the rule
A, B |- C
we can (according to our conditions) sometimes derived
B, A |- C
this also seems to be done already, however altough the premises are swapped, the arguments of the truth function are not, causing mistakes.

narjure.bag.DefaultBag StackOverflowError

Using a fresh started ircbot I get an StackOverflowError after the following 3 narsese lines:

<{tim} --> quacks>.
<duck --> quacks>.
<{tim} --> duck>?

This is with OpenNARS_2.0.0 / commit 5eac58f

Full stacktrace:

$ lein with-profile production trampoline run -m examples.ircbot
10:37:03.709 [main] INFO  c.p.actors.ActorRegistry - Actor registry is co.paralleluniverse.actors.LocalActorRegistry@7a6e0f3c
Beliefs rules: 3803
Questions rules: 474
Goal rules: 3813
Quests rules: 474
"Elapsed time: 59487.257198 msecs"
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:105] - reset question filter
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:107] - Resetting concepts bagss:
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:109] - c-bag count:  0
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:113] - Reset system Parameters:
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:115] - nars-id:  -1
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:117] - nars-time:  0
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:120] - NARS initialising...
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:56] - Initialising system timers...
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:51] -   [OK] :inference-timer (110 ms)
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:51] -   [OK] :system-timer (150 ms)
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:68] - System timer initialisation complete.
16-07-22 14:38:20 ubuntu-2gb-ams2-01 INFO [narjure.core:128] - NARS initialised.
Connecting... irc.freenode.org
Joining #narstest
NARS hears <{tim} --> quacks>.
NARS hears <duck --> quacks>.
NARS hears <{tim} --> duck>?
NARS answer on <{tim} --> duck>? is <{tim} --> duck>.  %1.0;0.44751381215469616%
Exception in Fiber "fiber-10000017" java.lang.StackOverflowError
        at clojure.lang.APersistentVector.equiv(APersistentVector.java:138)
        at clojure.lang.Util.pcequiv(Util.java:124)
        at clojure.lang.Util.equiv(Util.java:32)
        at clojure.core$not_EQ_.invokeStatic(core.clj:806)
        at clojure.core$not_EQ_.invoke(core.clj:800)
        at narjure.bag$compare_elements.invokeStatic(bag.clj:123)
        at narjure.bag$compare_elements.invoke(bag.clj:116)
        at clojure.lang.AFunction.compare(AFunction.java:47)
        at avl.clj$delete.invokeStatic(clj.clj:521)
        at avl.clj$delete.invoke(clj.clj:516)
        at avl.clj$delete.invokeStatic(clj.clj:554)
        at avl.clj$delete.invoke(clj.clj:516)
        at avl.clj$delete.invokeStatic(clj.clj:539)
        at avl.clj$delete.invoke(clj.clj:516)
        at avl.clj.AVLMap.without(clj.clj:885)
        at clojure.lang.RT.dissoc(RT.java:848)
        at clojure.core$dissoc.invokeStatic(core.clj:1462)
        at clojure.lang.RT.dissoc(RT.java:848)                                                                                          
        at clojure.core$dissoc.invokeStatic(core.clj:1462)
        at clojure.core$dissoc.invoke(core.clj:1455)
        at avl.clj.AVLSet.disjoin(clj.clj:1136)
        at clojure.core$disj.invokeStatic(core.clj:1477)
        at clojure.core$disj.invoke(core.clj:1469)
        at narjure.bag.DefaultBag.pop_element(bag.clj:89)
        at narjure.bag.DefaultBag.add_element(bag.clj:56)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
        at narjure.bag.DefaultBag.add_element(bag.clj:57)
... etc

Remaining TODO

Besides having a first working reasoner since today already, we are approaching the end of the development process. This issue shows the remaining things to do, from which I expect to be finished in the next two weeks with the help of Lense:

  1. Termlink based selection for general inference. (this I will finish next)
  2. Concept: Local Inference (with decision making rule, casting to operator executor) (Page 11 of design document)
  3. Make sure budget functions are implemented and applied as shown in the pdf. (Page 15 of design document)
  4. General-inferencer: Besides making sure that evidence trail is kept track of, don't even attempt derivation if there is evidental overlap between task and belief.
  5. Deriver: Apply project-eternalize on belief dependent on whether the rule has measure-time-predicate or not. (this I will do)
  6. task creator: Also create a eternalized task for each no matter from where incoming (derived or not derived) sentence message.
  7. GUI: Define a output block in lense, with corresponding "Clojure to Narsese string" translation which can easily be recursively defined, and which display atom is used by task-message.

Missing derivation in NAL2

Special theorem-implication rules of NAL2 are not working yet. However since these ones are rarely used and of low practical relevance, this is a low priority issue. After this one is fixed NAL2 will be fully supported:

(generate-conclusions
  (r/rules :belief)
  '{:statement  [--> [ext-set Tweety] [ext-set Birdie]]
    :truth      [0.9 0.9]
    :task-type  :belief
    :occurrence 1000}
  '{:statement  [ext-set Tweety]
    :truth      [1 0.9]
    :task-type  :belief
    :occurrence 1000})

Missing from conclusions:
"<{Birdie} <-> {Tweety}>. %1.0;0.9%"

Responsible rule:
#R[(S --> {P}) S |- (S <-> {P}) :post (:t/identity :d/identity :allow-backward)]

Should log messages be tested?

With some effort tests could register custom loggers and then test their output. In theory I would prefer to query state directly, but maybe using logs can help in distributed systems?

Event bug

When a event is entered, the task bag (of the concept it goes into) has an issue I didn't yet find the reason for, namely nil budget. (see the NullPointer exceptions and nil budget entries showing up in Lense at the inference-request-message print, will have time to debug on Friday).

`concept-creator` should not respond to `from` using `cast!`

If the initial cast! to the concept-creator did not origin from a server, the cast! will fail. It also introduces implicit knowledge (that from is the task-dispatcher).

As an alternative, the :create-concept-msg could be changed to a call! and return the concept as a response. The task-dispatcher can then spawn a fiber that calls :create-concept-msg and sends the :task-msg to the return value of the call!

Lein Marginalia failure

Doing the binary search for lein marg first failure:

dcf168dd5807d285d9cecd3ac99fa192adc1981e is the first bad commit

Full git bisect log: https://gist.github.com/jorisbontje/90bf0ce0aee30c84ab16e3653ffbf5a5

This seems to be the offending line currently causing lein marg to fail: https://github.com/opennars/opennars2/blob/2_0_3_simple_budget/src/narjure/memory_management/task_dispatcher.clj#L86

(found by creating a local copy of marginalia, with a println in the parse-file function)

duplicate link feedback message processing

TODO put outside of doseq:

(doseq [term terms]
(when (b/exists? @c-bag term)
(when task-concept-id
(when-let [{c-ref :ref} ((:elements-map @c-bag) task-concept-id)](cast! c-ref [:link-feedback-msg [task belief-concept-id]])))

Memory 'leak

when running with continuous input, memory use increases constantly. Been over 25gbs on my machine - no sign of it levelling off.

Tried various tests: disable concept generation
disable event generation

No difference - just a little slower increase in memory usage
had a look with visualVM profiler but not familiar enough for it to be useful

Deriver Variable Handling Issue

<(&&,<$1 --> flyer>,<$1 --> [chirping]>) ==> <$1 --> bird>>.
<<$1 --> [withWings]> ==> <$1 --> flyer>>.

Rules shouldn't only match if it is called $1 in both the first and second premise.
Why is this the case that these have to be equal altough they are just variable names?
Any idea, Roman?

Edge Case of Conditional Abduction (NAL5)

With rule

R[((&& M :list/A) ==> C) ((&& :list/A) ==> C) |- M :post (:t/abduction :order-for-all-same)]

the following works

(is (derived "<(&&,<robin --> [withWings]>,<robin --> [chirping]>) ==> <robin --> bird>>."
               "<(&&,<robin --> [flying]>,<robin --> [withWings]>,<robin --> [chirping]>) ==> <robin --> bird>>."
               ["<robin --> [flying]>. %1.00;0.45%"]))

but the following edge case of this rule does not:

(is (derived "<(&&,<robin --> swimmer>,<robin --> [flying]>) ==> <robin --> bird>>."
               "<<robin --> [flying]> ==> <robin --> bird>>."
               ["<robin --> swimmer>. %1.00;0.45%"]))

As you can see the second premise is the case where <robin --> [flying]> plays the role of a conjunction with a single element in the second premise.

Thoughts on this, Roman?

OutOfMemoryError: GC overhead limit exceeded after 30 min

with bb65735 on a 2GB DigitalOcean droplet

$ lein run -m examples.ircbot
05:31:58.323 [main] INFO  c.p.actors.ActorRegistry - Actor registry is co.paralleluniverse.actors.LocalActorRegistry@61375dff
Beliefs rules: 3151
Questions rules: 474
Goal rules: 3161
Quests rules: 474
"Elapsed time: 38474.858077 msecs"
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:105] - reset question filter
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:107] - Resetting concepts bagss:
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:109] - c-bag count:  0
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:113] - Reset system Parameters:
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:115] - nars-id:  -1
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:117] - nars-time:  0
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:120] - NARS initialising...
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:56] - Initialising system timers...
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:51] -   [OK] :inference-timer (110 ms)
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:51] -   [OK] :system-timer (150 ms)
16-07-11 09:32:53 ubuntu-2gb-ams2-01 INFO [narjure.core:68] - System timer initialisation complete.
16-07-11 09:32:54 ubuntu-2gb-ams2-01 INFO [narjure.core:128] - NARS initialised.
16-07-11 09:33:04 ubuntu-2gb-ams2-01 INFO [narjure.core:56] - Initialising system timers...
16-07-11 09:33:04 ubuntu-2gb-ams2-01 INFO [narjure.core:51] -   [OK] :inference-timer (25 ms)
16-07-11 09:33:04 ubuntu-2gb-ams2-01 INFO [narjure.core:51] -   [OK] :system-timer (50 ms)
16-07-11 09:33:04 ubuntu-2gb-ams2-01 INFO [narjure.core:68] - System timer initialisation complete.
Connecting... irc.freenode.org
Joining #narstest
NARS hears <{Tweety} --> [yellow]>.
NARS hears <canary --> [yellow]>.
NARS hears <canary --> bird>.
NARS hears <{Tweety} --> bird>?
NARS answer on <{Tweety} --> bird>? is <{Tweety} --> bird>.  %1.0;0.40276243093922653%
Exception in thread "SimpleQuartzScheduler:-1011881444_QuartzSchedulerThread" Exception in Fiber "fiber-10000002" Exception in thread "Thread-2" Exception in Fiber "fiber-10000005" java.lang.OutOfMemoryError: GC overhead limit exceeded
        at org.quartz.impl.JobExecutionContextImpl.<init>(JobExecutionContextImpl.java:76)
        at org.quartz.core.JobRunShell.initialize(JobRunShell.java:143)
        at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:375)

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-2"
Exception in thread "Timer-0" java.lang.OutOfMemoryError: GC overhead limit exceeded
Exception in thread "FiberTimedScheduler-default-fiber-pool" java.lang.OutOfMemoryError: GC overhead limit exceeded
Exception in thread "scheduling-worker-4" java.lang.OutOfMemoryError: GC overhead limit exceeded
Exception in Fiber "fiber-10000171" Exception in Fiber "fiber-10000006" Exception in Fiber "fiber-10000064" Exception in Fiber "fiber-10000007" Exception in Fiber "fiber-10000024" Exception in Fiber "fiber-10000169" Exception in Fiber "fiber-10000067" Exception in Fiber "fiber-10000159" Exception in Fiber "fiber-10000013" Exception in Fiber "fiber-10000057" Exception in Fiber "fiber-10000079"

NAL Property Tests

Using test.check we need to property test the NAL rules against the Deriver.

Question about proposed setup

New to NARS, looking for direction on setup, environment specifications and if possible minimum requirements. I've been trying to run on unix environments with little success. For some reason I can't open the GUI when using lein repl.

Actor Tests

We need to find a way to test the individual actors message I/O

NAL4 image to product.

(generate-conclusions
  (r/rules :belief)
  '{:statement  [--> base [ext-image reaction acid _]]
    :truth      [0.9 0.9]
    :task-type  :belief
    :occurrence :eternal}
  '{:statement  reaction
    :truth      [1 0.9]
    :task-type  :belief
    :occurrence :eternal})
=> ()

Expected output:

<(acid,base) --> reaction>. %1.0;0.9%

Rule:

(Ai --> (/ M :list/A )) M |- ((* :list/A) --> M)
               :pre ((:substitute-from-list _ Ai) (:contains? (:list/A) Ai))
               :post (:t/identity :d/identity)

NAL4: Product/Image Transformations broken.

(generate-conclusions
  (r/rules :belief)
  '{:statement  [--> [product A B] C]
    :truth      [0.9 0.9]
    :task-type  :belief
    :occurrence 1000}
  '{:statement  [A]
    :truth      [1 0.9]
    :task-type  :belief
    :occurrence 1000})

Expected:
<A --> (/,C,_,B)>. %1.0;0.9%

by rule:
(* :list/A) --> M) Ai |- (Ai --> (/ M :list/A)) :pre ((:substitute-from-list Ai _) (:contains? (:list/A) Ai)) :post (:t/identity :d/identity)

Same issue with all other product and image related transformation rules in the "; NAL4 - Transformations between products and images" section.

Broken tests in nal.test.deriver and narjure.test.narsese

https://circleci.com/gh/opennars/opennars2/615

lein trampoline test
Retrieving com/google/protobuf/protobuf-java/2.6.1/protobuf-java-2.6.1.jar from central
12:15:03.613 [main] INFO  c.p.actors.ActorRegistry - Actor registry is co.paralleluniverse.actors.LocalActorRegistry@55236822
Beliefs rules: 3151
Questions rules: 474
Goal rules: 3161
Quests rules: 474
"Elapsed time: 23898.244313 msecs"

lein test nal.test.deriver

lein test :only nal.test.deriver/variable_unification6

ERROR in (variable_unification6) (unify.clj:95)
expected: (derived "<(&&,<$1 --> flyer>,<$1 --> [chirping]>, <($1, worms) --> food>) ==> <$1 --> bird>>." "<(&&,<$1 --> [chirping]>,<$1 --> [withWings]>) ==> <$1 --> bird>>." ["<(&&,<$1 --> flyer>,<($1, worms) --> food>) ==> <$1 --> [withWings]>>. %1.00;0.45%" "<<$1 --> [withWings]> ==> (&&,<$1 --> flyer>,<($1, worms) --> food>)>. %1.00;0.45%"])
  actual: java.lang.IllegalStateException: Cycle found in the path [* [ind-var 1] worms]
 at clojure.core.unify$var_unify__5706.invokeStatic (unify.clj:95)
    clojure.core.unify/var_unify (unify.clj:95)
    clojure.core.unify$garner_unifiers.invokeStatic (unify.clj:118)
    clojure.core.unify$garner_unifiers.invoke (unify.clj:105)
    clojure.core.unify$garner_unifiers.invokeStatic (unify.clj:125)
    clojure.core.unify$garner_unifiers.invoke (unify.clj:105)
    clojure.core.unify$garner_unifiers.invokeStatic (unify.clj:121)
    clojure.core.unify$garner_unifiers.invoke (unify.clj:105)
    clojure.core.unify$garner_unifiers.invokeStatic (unify.clj:125)
    clojure.core.unify$garner_unifiers.invoke (unify.clj:105)
    clojure.core.unify$garner_unifiers.invokeStatic (unify.clj:121)
    clojure.core.unify$garner_unifiers.invoke (unify.clj:105)
    clojure.core.unify$garner_unifiers.invokeStatic (unify.clj:121)
    clojure.core.unify$garner_unifiers.invoke (unify.clj:105)
    clojure.core.unify$make_occurs_unify_fn$fn__5739.invoke (unify.clj:173)
    nal.deriver.substitution$unification_map.invokeStatic (substitution.clj:19)
    nal.deriver.substitution$unification_map.invoke (substitution.clj:13)
    nal.rules$eval13267$fn__13270.invoke (rules.clj:692)
    nal.deriver$get_matcher$fn__93646$fn__93647.invoke (deriver.clj:19)
    clojure.core$map$fn__4785.invoke (core.clj:2646)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.RT.seq (RT.java:521)
    clojure.core$seq__4357.invokeStatic (core.clj:137)
    clojure.core$apply.invokeStatic (core.clj:641)
    clojure.core$mapcat.invokeStatic (core.clj:2674)
    clojure.core$mapcat.doInvoke (core.clj:2674)
    clojure.lang.RestFn.invoke (RestFn.java:423)
    nal.deriver$get_matcher$fn__93646.invoke (deriver.clj:19)
    nal.deriver$generate_conclusions_no_commutativity.invokeStatic (deriver.clj:30)
    nal.deriver$generate_conclusions_no_commutativity.invoke (deriver.clj:26)
    nal.deriver$generate_conclusions$iter__93688__93692$fn__93693$fn__93694.invoke (deriver.clj:72)
    nal.deriver$generate_conclusions$iter__93688__93692$fn__93693.invoke (deriver.clj:71)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.RT.seq (RT.java:521)
    clojure.core$seq__4357.invokeStatic (core.clj:137)
    clojure.core$apply.invokeStatic (core.clj:641)
    clojure.core$apply.invoke (core.clj:641)
    nal.deriver$generate_conclusions.invokeStatic (deriver.clj:71)
    nal.deriver$generate_conclusions.invoke (deriver.clj:68)
    nal.deriver$reorder_inference.invokeStatic (deriver.clj:95)
    nal.deriver$reorder_inference.invoke (deriver.clj:89)
    nal.deriver$inference.invokeStatic (deriver.clj:115)
    nal.deriver$inference.invoke (deriver.clj:102)
    nal.test_utils$conclusions.invokeStatic (test_utils.clj:23)
    nal.test_utils$conclusions.invoke (test_utils.clj:18)
    nal.test_utils$derived$fn__95067$fn__95068.invoke (test_utils.clj:37)
    clojure.core$every_QMARK_.invokeStatic (core.clj:2572)
    clojure.core$every_QMARK_.invoke (core.clj:2563)
    nal.test_utils$derived$fn__95067.invoke (test_utils.clj:31)
    clojure.lang.AFn.call (AFn.java:18)
    clojure.lang.LockingTransaction.run (LockingTransaction.java:273)
    clojure.lang.LockingTransaction.runInTransaction (LockingTransaction.java:229)
    nal.test_utils$derived.invokeStatic (test_utils.clj:28)
    nal.test_utils$derived.invoke (test_utils.clj:25)
    clojure.lang.AFn.applyToHelper (AFn.java:160)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.core$apply.invoke (core.clj:641)
    nal.test.deriver$fn__95552.invokeStatic (deriver.clj:551)
    nal.test.deriver/fn (deriver.clj:550)
    clojure.test$test_var$fn__7983.invoke (test.clj:716)
    clojure.test$test_var.invokeStatic (test.clj:716)
    clojure.test$test_var.invoke (test.clj:707)
    clojure.test$test_vars$fn__8005$fn__8010.invoke (test.clj:734)
    clojure.test$default_fixture.invokeStatic (test.clj:686)
    clojure.test$default_fixture.invoke (test.clj:682)
    clojure.test$test_vars$fn__8005.invoke (test.clj:734)
    clojure.test$default_fixture.invokeStatic (test.clj:686)
    clojure.test$default_fixture.invoke (test.clj:682)
    clojure.test$test_vars.invokeStatic (test.clj:730)
    clojure.test$test_all_vars.invokeStatic (test.clj:736)
    clojure.test$test_ns.invokeStatic (test.clj:757)
    clojure.test$test_ns.invoke (test.clj:742)
    clojure.core$map$fn__4785.invoke (core.clj:2646)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.Cons.next (Cons.java:39)
    clojure.lang.RT.boundedLength (RT.java:1749)
    clojure.lang.RestFn.applyTo (RestFn.java:130)
    clojure.core$apply.invokeStatic (core.clj:648)
    clojure.test$run_tests.invokeStatic (test.clj:767)
    clojure.test$run_tests.doInvoke (test.clj:767)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.core$apply.invoke (core.clj:641)
    user$eval85$fn__144$fn__175.invoke (form-init3172037995660785312.clj:1)
    user$eval85$fn__144$fn__145.invoke (form-init3172037995660785312.clj:1)
    user$eval85$fn__144.invoke (form-init3172037995660785312.clj:1)
    user$eval85.invokeStatic (form-init3172037995660785312.clj:1)
    user$eval85.invoke (form-init3172037995660785312.clj:1)
    clojure.lang.Compiler.eval (Compiler.java:6927)
    clojure.lang.Compiler.eval (Compiler.java:6917)
    clojure.lang.Compiler.load (Compiler.java:7379)
    clojure.lang.Compiler.loadFile (Compiler.java:7317)
    clojure.main$load_script.invokeStatic (main.clj:275)
    clojure.main$init_opt.invokeStatic (main.clj:277)
    clojure.main$init_opt.invoke (main.clj:277)
    clojure.main$initialize.invokeStatic (main.clj:308)
    clojure.main$null_opt.invokeStatic (main.clj:342)
    clojure.main$null_opt.invoke (main.clj:339)
    clojure.main$main.invokeStatic (main.clj:421)
    clojure.main$main.doInvoke (main.clj:384)
    clojure.lang.RestFn.invoke (RestFn.java:421)
    clojure.lang.Var.invoke (Var.java:383)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)

lein test :only nal.test.deriver/second_level_variable_unification2

FAIL in (second_level_variable_unification2) (deriver.clj:656)
expected: (derived "<{key1} --> key>. %1.00;0.90%" "<<$X --> lock> ==> (&&,<#Y --> key>,<$X --> (/,open,#Y,_)>)>. %1.00;0.90%" ["<<$X --> lock> ==> <$X --> (/,open,{key1},_)>>. %1.00;0.42%"])
  actual: (not (derived "<{key1} --> key>. %1.00;0.90%" "<<$X --> lock> ==> (&&,<#Y --> key>,<$X --> (/,open,#Y,_)>)>. %1.00;0.90%" ["<<$X --> lock> ==> <$X --> (/,open,{key1},_)>>. %1.00;0.42%"]))

lein test :only nal.test.deriver/second_level_variable_unification

FAIL in (second_level_variable_unification) (deriver.clj:649)
expected: (derived "<{key1} --> key>. %1.00;0.90%" "(&&,<#1 --> lock>,<<$2 --> key> ==> <#1 --> (/,open,$2,_)>>). %1.00;0.90%" ["(&&,<#1 --> lock>,<#1 --> (/,open,{key1},_)>). %1.00;0.81%"])
  actual: (not (derived "<{key1} --> key>. %1.00;0.90%" "(&&,<#1 --> lock>,<<$2 --> key> ==> <#1 --> (/,open,$2,_)>>). %1.00;0.90%" ["(&&,<#1 --> lock>,<#1 --> (/,open,{key1},_)>). %1.00;0.81%"]))

lein test :only nal.test.deriver/negation

FAIL in (negation) (deriver.clj:444)
expected: (derived "(--,<robin --> [flying]>). %0.1;0.9%" "<robin --> [flying]>?" ["<robin --> [flying]>. %0.90;0.90%"])
  actual: (not (derived "(--,<robin --> [flying]>). %0.1;0.9%" "<robin --> [flying]>?" ["<robin --> [flying]>. %0.90;0.90%"]))

lein test nal.test.deriver.backward-rules

lein test nal.test.deriver.key-path

lein test nal.test.deriver.list-expansion

lein test nal.test.deriver.matching

lein test nal.test.deriver.normalization

lein test nal.test.deriver.preconditions

lein test nal.test.deriver.premises-swapping

lein test nal.test.deriver.rules

lein test nal.test.deriver.substitution

lein test nal.test.deriver.terms-premutation

lein test nal.test.deriver.truth

lein test :only nal.test.deriver.truth/test-structual-abduction

FAIL in (test-structual-abduction) (truth.clj:173)
expected: (clojure.core/= [0.7 0.15254237288135597] (structual-abduction [0.7 0.2] [1 0.9]))
  actual: (not (clojure.core/= [0.7 0.15254237288135597] [1 0.44751381215469616]))

lein test :only nal.test.deriver.truth/test-structual-abduction

FAIL in (test-structual-abduction) (truth.clj:173)
expected: (clojure.core/= [1 0.44751381215469616] (structual-abduction [1 0.9] [0.7 0.2]))
  actual: (not (clojure.core/= [1 0.44751381215469616] [0.7 0.15254237288135597]))

lein test :only nal.test.deriver.truth/test-belief-identity

FAIL in (test-belief-identity) (truth.clj:191)
expected: (clojure.core/= [1 0.6] (belief-identity [1 0.6] [1 0.7]))
  actual: (not (clojure.core/= [1 0.6] [1 0.7]))

lein test :only nal.test.deriver.truth/test-belief-identity

FAIL in (test-belief-identity) (truth.clj:191)
expected: (clojure.core/= [0.3 0.6] (belief-identity [0.3 0.6] [0.1 0.8]))
  actual: (not (clojure.core/= [0.3 0.6] [0.1 0.8]))

lein test nal.test.reader

lein test nal.test.test-utils

lein test narjure.test.bag

lein test narjure.test.narsese

lein test :only narjure.test.narsese/test-parser

FAIL in (test-parser) (narsese.clj:24)
expected: (= (quote [retrospective-implication [--> [* [ind-var x] room_101] enter] [--> [* [ind-var x] door_101] open]]) (narsese->clj "<<( $x, room_101) --> enter> =\\> <( $x, door_101) --> open>>. %0.9;0.1%"))
  actual: (not (= [retrospective-implication [--> [* [ind-var x] room_101] enter] [--> [* [ind-var x] door_101] open]] [retro-impl [--> [* [ind-var x] room_101] enter] [--> [* [ind-var x] door_101] open]]))

Ran 210 tests containing 427 assertions.
8 failures, 1 errors.

lein trampoline test returned exit code 9

?what question handling issue

concept/solution-update-handler assumes that old-task (selected from task bag) is same as the matching task-bag entry , but this is not the case as the bag entry has been returned to the bag with an updated budget due to forget-element.

Low priority issue but needs resolving at some point

NAL5 Issue

Given rule

(M ==> S) (M ==> (&& S :list/A)) |- (M ==> (&& :list/A)) :post (:t/decompose-pnn :order-for-all-same :seq-interval-from-premises)

why is derivation of

<<robin --> bird> ==> <robin --> animal>>. %0.00;0.81%

from

<<robin --> bird> ==> <robin --> [flying]>>.
<<robin --> bird> ==> (&&,<robin --> [flying]>,<robin --> animal>)>. %0.0;0.9%

not possible?
Any idea here, Roman?

Commutative terms matching

Internal representation for (<-> A B) should be (<-> #{A B}) in order to allow taking commutativity of <-> into account by the rule engine. Also for consistency: (--> [A B]) instead of (--> A B).

Motivation:

(conclusions "<gull --> swimmer>."
             "<swan <-> gull>.")
=>
#{{:statement [--> swan swimmer], :task-type :belief, :occurrence 0, :truth [1.0 0.81]} ...}

with

<gull <-> swan>.

the derivation currently can not happen without additional rule.

Potential sources of a memory leak

Usage of register!/unregister! for actors

IMO registering of actors should be moved outside of the actors. The server actors should be agnostic to the names of themselves and their dependencies to allow better mocking and dynamic behavior (e.g. replacing dependencies at run-time)

Developing and testing using the repl is harder if we use global state. If an actor crashes it will not be unregistered and it has to be manually unregistered.

Blocking calls inside the server behaviors lead to warnings (Uninstrumented methods or call-sites), so calling (whereis actor-name) inside the servers is error prone (Sometimes narjure/core.clj fails to initialize the actors)

A monitor or supervisor actor can be used to register the actors at a later stage. The server actors can be extended to handle a message

[:actor-msg actor-name actor]
The handler can then set the internal reference to the actor, if the server actor is interested in it. The supervisor could broadcast that message whenever a server restarts.

For initialization, the actors initialization function can take additional parameters with their dependencies. If circular dependencies exist, the actors can be lazily initialized using the actor-msg.

NAL3 Truth Function Inconsistent with Docs

https://github.com/opennars/opennars2/blob/2.0.0_postdev1/src/nal/deriver/truth.clj#L101

(t-and c1 c2)

https://github.com/opennars/opennars2/blob/2.0.0_postdev1/docs/NAL-spec/NAL-3.tex#L206

c &=& or(and(not(f_1), c_1), and(not(f_2), c_2)) + and(f_1, c_1, f_2, c_2)

the preceding paragraph in the NAL spec explains:

When T 1 and T 2 are either highly
similar or opposite to each other, the compound terms produced by these
rules may not have much practical value. However, even when it happens,
it is an issue to be handled by inference control, not by logic.
In the confidence functions, each case for the conclusion to reach its
maximum is separately considered. The plus operator is used in place of an
or operator, because the two cases involved are mutually exclusive, rather
than independent of each other.

i had suspected a symmetric form of this function was missing for negated cases of certain truth functions. not only is the code missing the negated case, inconsistent for the positive case, but i see a possible mistake written for the unimplemented negated case. taking the intersection case as an example

c = or(and(not(f 1 ), c 1 ), and(not(f 2 ), c 2 )) + and(f 1 , c 1 , f 2 , c 2 )

the first component of this formula alone can produce confidence values higher than its conf inputs (ex: two 90% conf inputs producing a 98% conf output in one test case). no other truth functions compute a confidence combining freq and conf in an or( ) in this way.

my guess is that that '+' actually means max as the explanation seems to suggest, and that one of these variations will produce more reasonable confidence values for the various positive and negative combinations.

max(and(f1, f2, c1, c2), and( 1-f1, c1, 1-f2, c2 ))
max(and(f1, f2, c1, c2), and( or(1-f1, 1-f2), c1, c2 ))

otherwise please clarify the documentation and/or why the code seems inconsistent for these functions (including opennars 1.x)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.