From 209e256913b5c25ba35ff4ae78bdc57ba3070760 Mon Sep 17 00:00:00 2001 From: Lee Spector Date: Thu, 22 Apr 2021 20:39:23 -0400 Subject: [PATCH] Handle -main args correctly in REPL or from command line; update README for specifying problem --- README.md | 16 ++++++++-------- src/propeller/core.cljc | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cf514c5..56511eb 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,15 @@ Yet another Push-based genetic programming system in Clojure. ## Usage -To run PushGP on the default genetic programming problem -from a REPL, load propel.core into your REPL (i.e. `lein repl`), -and run `(-main)`. +To run PushGP from a REPL, load propel.core into your REPL (i.e. `lein repl`), +and run `-main` with arguments including, first, the problem name, for example: +`(-main 'simple-regression)` or `(-main 'simple-regression :population-size 100)`. -To run PushGP on the default genetic programming problem from -command line, execute `lein run`. Command-line arguments may -be provided to override the defaults specified in `-main`, for -example, `lein run :population-size 100`. You can use something -like `lein run | tee outfile` to send output both to the terminal +To run PushGP on the genetic programming problem p from the +command line, execute `lein run p`. For example `lein run simple-regression`. Additional command-line arguments may +be provided to override the default key/value pairs specified in `-main`, for +example, `lein run simple-regression :population-size 100`. You can use something +like `lein run simple-regression | tee outfile` to send output both to the terminal and to `outfile`. ## CLJS Usage diff --git a/src/propeller/core.cljc b/src/propeller/core.cljc index 720184f..d24adb8 100755 --- a/src/propeller/core.cljc +++ b/src/propeller/core.cljc @@ -33,6 +33,7 @@ :variation {:umad 0.5 :crossover 0.5} :elitism false} (apply hash-map - (map read-string (rest args)))) + (map #(if (string? %) (read-string %) %) + (rest args)))) [:error-function] identity)))