Define arglist in problem file and use it in -main; so far just for simple-regression

This commit is contained in:
Lee Spector 2021-07-13 18:27:28 -04:00
parent ec65f959f2
commit 09375d1643
2 changed files with 7 additions and 6 deletions

View File

@ -19,14 +19,10 @@
(println "Try, for example:") (println "Try, for example:")
(println " lein run software.smallest") (println " lein run software.smallest")
(System/exit 1)) (System/exit 1))
;; Creates problems
(require (symbol (str "propeller.problems." (first args)))) (require (symbol (str "propeller.problems." (first args))))
(gp/gp (gp/gp
(merge (merge
{:instructions (eval-problem-var (first args) "instructions") {:max-generations 500
:error-function (eval-problem-var (first args) "error-function")
:max-generations 500
:population-size 500 :population-size 500
:max-initial-plushy-size 100 :max-initial-plushy-size 100
:step-limit 200 :step-limit 200
@ -37,6 +33,7 @@
:elitism false :elitism false
:PSB2-path "" :PSB2-path ""
:PSB2-problem (clojure.string/replace (first args) #"PSB2." "")} :PSB2-problem (clojure.string/replace (first args) #"PSB2." "")}
(eval-problem-var (first args) "arglist")
(apply hash-map (apply hash-map
(map #(if (and (string? %) (not (.contains % "/"))) (read-string %) %) (map #(if (and (string? %) (not (.contains % "/"))) (read-string %) %)
(rest args)))))) (rest args))))))

View File

@ -71,4 +71,8 @@
:behaviors outputs :behaviors outputs
:errors errors :errors errors
:total-error #?(:clj (apply +' errors) :total-error #?(:clj (apply +' errors)
:cljs (apply + errors)))))) :cljs (apply + errors))))))
(def arglist
{:instructions instructions
:error-function error-function})