Handle -main args correctly in REPL or from command line; update README for specifying problem

This commit is contained in:
Lee Spector 2021-04-22 20:39:23 -04:00
parent 6dac92f15f
commit 209e256913
2 changed files with 10 additions and 9 deletions

View File

@ -4,15 +4,15 @@ Yet another Push-based genetic programming system in Clojure.
## Usage ## Usage
To run PushGP on the default genetic programming problem To run PushGP from a REPL, load propel.core into your REPL (i.e. `lein repl`),
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:
and run `(-main)`. `(-main 'simple-regression)` or `(-main 'simple-regression :population-size 100)`.
To run PushGP on the default genetic programming problem from To run PushGP on the genetic programming problem p from the
command line, execute `lein run`. Command-line arguments may command line, execute `lein run p`. For example `lein run simple-regression`. Additional command-line arguments may
be provided to override the defaults specified in `-main`, for be provided to override the default key/value pairs specified in `-main`, for
example, `lein run :population-size 100`. You can use something example, `lein run simple-regression :population-size 100`. You can use something
like `lein run | tee outfile` to send output both to the terminal like `lein run simple-regression | tee outfile` to send output both to the terminal
and to `outfile`. and to `outfile`.
## CLJS Usage ## CLJS Usage

View File

@ -33,6 +33,7 @@
:variation {:umad 0.5 :crossover 0.5} :variation {:umad 0.5 :crossover 0.5}
:elitism false} :elitism false}
(apply hash-map (apply hash-map
(map read-string (rest args)))) (map #(if (string? %) (read-string %) %)
(rest args))))
[:error-function] [:error-function]
identity))) identity)))