lspector / Clojush

The Push programming language and the PushGP genetic programming system implemented in Clojure.
http://hampshire.edu/lspector/push.html
Eclipse Public License 1.0
331 stars 94 forks source link

bioavailablity.clj example throws "Undefioned instruction" exception #269

Closed transducer closed 5 years ago

transducer commented 5 years ago

When I run the bioavailability example by adding (pushgp argmap) to the bottom of the file and evaluating it, I get the following output with exception:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Generating initial population...
Processing generation: 0
Computing errors... 
Exception Undefined instruction: ...
Exception Undefined instruction: ...
Exception Undefined instruction: ...
Exception Undefined instruction: ...
Exception Undefined instruction: ...
Exception Undefined instruction: ...
Exception Undefined instruction: ...
Exception Undefined instruction: ...
    clojush.interpreter/execute-instruction (interpreter.clj:44)
    clojush.interpreter/execute-instruction (interpreter.clj:9)
    clojush.interpreter/execute-instruction (interpreter.clj:44)
    clojush.interpreter/eval-push (interpreter.clj:83)  clojush.interpreter/execute-instruction (interpreter.clj:44)
    clojush.interpreter/execute-instruction (interpreter.clj:44)
    clojush.interpreter/execute-instruction (interpreter.clj:9)
    clojush.interpreter/eval-push (interpreter.clj:83)
    clojush.interpreter/eval-push (interpreter.clj:48)
    clojush.interpreter/run-push (interpreter.clj:120)
    clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/run-push (interpreter.clj:107)
    clojush.interpreter/execute-instruction (interpreter.clj:44)

    clojush.interpreter/eval-push (interpreter.clj:48)
    clojush.interpreter/execute-instruction (interpreter.clj:44)
    clojush.interpreter/execute-instruction (interpreter.clj:44)
    clojush.interpreter/execute-instruction (interpreter.clj:44)

    clojush.interpreter/execute-instruction (interpreter.clj:9)
    clojush.interpreter/run-push (interpreter.clj:120)  clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/eval-push (interpreter.clj:83)  clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/eval-push (interpreter.clj:48)
    clojush.interpreter/run-push (interpreter.clj:120)

    clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/execute-instruction (interpreter.clj:9)
    clojush.problems.regression.bioavailability/bioavailability-error-function/iter--20598--20602/fn--20603 (bioavailability.clj:104)
    clojush.interpreter/execute-instruction (interpreter.clj:9) clojush.interpreter/execute-instruction (interpreter.clj:9)

    clojush.interpreter/run-push (interpreter.clj:107)  clojush.interpreter/execute-instruction (interpreter.clj:9)

    clojush.interpreter/run-push (interpreter.clj:107)

    clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/eval-push (interpreter.clj:83)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojush.problems.regression.bioavailability/bioavailability-error-function/iter--20598--20602/fn--20603 (bioavailability.clj:104)
    clojush.interpreter/execute-instruction (interpreter.clj:9) clojure.lang.LazySeq.seq (LazySeq.java:49)

    clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/eval-push (interpreter.clj:83)
    clojush.problems.regression.bioavailability/bioavailability-error-function/iter--20598--20602/fn--20603 (bioavailability.clj:104)

    clojush.interpreter/eval-push (interpreter.clj:48)  clojure.lang.LazySeq.sval (LazySeq.java:40)

    clojure.lang.RT.seq (RT.java:521)
    clojush.interpreter/eval-push (interpreter.clj:83)  clojure.core/seq--4357 (core.clj:137)

    clojush.interpreter/eval-push (interpreter.clj:83)
    clojush.interpreter/eval-push (interpreter.clj:83)
    clojush.interpreter/eval-push (interpreter.clj:48)
    clojush.interpreter/eval-push (interpreter.clj:48)
    clojush.interpreter/run-push (interpreter.clj:120)
    clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/eval-push (interpreter.clj:48)  clojush.interpreter/run-push (interpreter.clj:107)

    clojush.interpreter/run-push (interpreter.clj:120)
    clojush.interpreter/run-push (interpreter.clj:102)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojush.interpreter/run-push (interpreter.clj:107)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.RT.seq (RT.java:521)
    clojure.core/seq--4357 (core.clj:137)
    clojure.core/dorun (core.clj:3024)
    clojure.core/doall (core.clj:3039)
    clojure.core/doall (core.clj:3039)
    clojush.problems.regression.bioavailability/bioavailability-error-function (bioavailability.clj:100)
    clojush.problems.regression.bioavailability/bioavailability-error-function (bioavailability.clj:95)
    clojure.core/partial/fn--4759 (core.clj:2515)
    clojush.evaluate/evaluate-individual (evaluate.clj:74)
    clojush.evaluate/evaluate-individual (evaluate.clj:57)
    clojure.core/apply (core.clj:652)
    clojure.core/binding-conveyor-fn/fn--4676 (core.clj:1949)
    clojure.lang.Agent$Action.doRun (Agent.java:114)
    clojure.lang.Agent$Action.run (Agent.java:163)
    java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    java.lang.Thread.run (Thread.java:748)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.RT.seq (RT.java:521)
    clojure.core/seq--4357 (core.clj:137)
    clojure.core/dorun (core.clj:3024)
    clojush.interpreter/run-push (interpreter.clj:120)
    clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/run-push (interpreter.clj:107)
    clojush.interpreter/run-push (interpreter.clj:102)
    clojush.interpreter/run-push (interpreter.clj:102)
    clojure.core/dorun (core.clj:3024)
    clojush.interpreter/run-push (interpreter.clj:120)  clojush.interpreter/eval-push (interpreter.clj:48)  clojure.core/doall (core.clj:3039)

    clojush.interpreter/run-push (interpreter.clj:102)  clojush.interpreter/run-push (interpreter.clj:120)

    clojush.interpreter/run-push (interpreter.clj:107)
    clojush.interpreter/run-push (interpreter.clj:102)
    clojush.problems.regression.bioavailability/bioavailability-error-function/iter--20598--20602/fn--20603 (bioavailability.clj:104)
    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 (core.clj:137)

How can I get this program to work?

lspector commented 5 years ago

I think this must have to do with the way you are starting the evaluation.

If I run lein run clojush.problems.regression.bioavailability from the command line (which will cause pushgp to be called from -main) then it runs correctly.

I can also open the project and then the file in Visual Studio Code (with the Calva extensions), start and attach to a REPL, add (pushgp argmap) to the bottom of the file, and then select all and choose "Run Selected Text" from the "Terminal" window. This works correctly too.

Your problem probably may stem from the way that namespaces are handled in conjunction with problem files, all of which define argmap so you have to be in the right namespace to get the right one, and access to other problem-specific symbols. I am quite sure that we did this weirdly/poorly, and that it should be done differently. But we set this up a long time ago, when we were all new to Clojure and didn't really understand how namespaces should be used. I'm sorry if this is a pain, and I'm sure it'd be good to re-do a lot of this, but that's the way it is right now.

transducer commented 5 years ago

Thanks for the clarification! I will try again after the weekend.