Update -main in propeller.core to just print a message

This commit is contained in:
Lee Spector 2021-07-14 16:41:42 -04:00
parent 5240423f66
commit 1cc2b26df2

View File

@ -1,34 +1,10 @@
(ns propeller.core (ns propeller.core
#?(:clj (:gen-class)) #?(:clj (:gen-class)))
(:require [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
(defn eval-problem-var
[problem-name var-name]
(eval (symbol (str "propeller.problems." problem-name "/" var-name))))
(defn -main (defn -main
"Runs propel-gp, giving it a map of arguments." "Not intended to be run; just print a message."
[& args] [& args]
;; Exception for when no args were passed ;; Exception for when no args were passed
(when (empty? args) (println "To run a genetic programming problem, provide a the problem's")
(println "You must specify a problem to run.") (println "namespace as specified in the Propeller README file at")
(println "Try, for example:") (println "https://github.com/lspector/propeller/blob/master/README.md"))
(println " lein run software.smallest")
(System/exit 1))
(require (symbol (str "propeller.problems." (first args))))
(gp/gp
(merge
{:max-generations 500
:population-size 500
:max-initial-plushy-size 100
:step-limit 200
:parent-selection :lexicase
:tournament-size 5
:umad-rate 0.1
:variation {:umad 0.5 :crossover 0.5}
:elitism false}
(eval-problem-var (first args) "arglist")
(apply hash-map
(map #(if (and (string? %) (not (.contains % "/"))) (read-string %) %)
(rest args))))))