From 09375d1643d61190ceda96c6ab285951adf58ceb Mon Sep 17 00:00:00 2001 From: Lee Spector Date: Tue, 13 Jul 2021 18:27:28 -0400 Subject: [PATCH] Define arglist in problem file and use it in -main; so far just for simple-regression --- src/propeller/core.cljc | 7 ++----- src/propeller/problems/simple_regression.cljc | 6 +++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/propeller/core.cljc b/src/propeller/core.cljc index a95e928..59d1c7f 100755 --- a/src/propeller/core.cljc +++ b/src/propeller/core.cljc @@ -19,14 +19,10 @@ (println "Try, for example:") (println " lein run software.smallest") (System/exit 1)) - - ;; Creates problems (require (symbol (str "propeller.problems." (first args)))) (gp/gp (merge - {:instructions (eval-problem-var (first args) "instructions") - :error-function (eval-problem-var (first args) "error-function") - :max-generations 500 + {:max-generations 500 :population-size 500 :max-initial-plushy-size 100 :step-limit 200 @@ -37,6 +33,7 @@ :elitism false :PSB2-path "" :PSB2-problem (clojure.string/replace (first args) #"PSB2." "")} + (eval-problem-var (first args) "arglist") (apply hash-map (map #(if (and (string? %) (not (.contains % "/"))) (read-string %) %) (rest args)))))) \ No newline at end of file diff --git a/src/propeller/problems/simple_regression.cljc b/src/propeller/problems/simple_regression.cljc index 3f40580..cd56a97 100755 --- a/src/propeller/problems/simple_regression.cljc +++ b/src/propeller/problems/simple_regression.cljc @@ -71,4 +71,8 @@ :behaviors outputs :errors errors :total-error #?(:clj (apply +' errors) - :cljs (apply + errors)))))) \ No newline at end of file + :cljs (apply + errors)))))) + +(def arglist + {:instructions instructions + :error-function error-function}) \ No newline at end of file