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
#?(: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))))
#?(:clj (:gen-class)))
(defn -main
"Runs propel-gp, giving it a map of arguments."
"Not intended to be run; just print a message."
[& args]
;; Exception for when no args were passed
(when (empty? args)
(println "You must specify a problem to run.")
(println "Try, for example:")
(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))))))
(println "To run a genetic programming problem, provide a the problem's")
(println "namespace as specified in the Propeller README file at")
(println "https://github.com/lspector/propeller/blob/master/README.md"))