Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (47 sloc) 2.17 KB
;; tagged_regression.clj
;; an example problem for clojush, a Push/PushGP system written in Clojure
;; Lee Spector,, 2010
(ns clojush.problems.demos.tagged-regression
(:use [clojush.pushgp.pushgp]
;; Integer symbolic regression of x^3 - 2x^2 - x (problem 5 from the
;; trivial geography chapter) with minimal integer instructions
;; ALSO uses tags, although there is little reason to think they would
;; help on such a simple problem.
(def argmap
{:error-function (fn [individual]
(assoc individual
(for [input (range 10)]
(let [state (run-push (:program individual)
(push-item input :input
(push-item input :integer
top-int (top-item :integer state)]
(if (number? top-int)
(abs (- top-int
(- (* input input input)
(* 2 input input) input)))
:atom-generators (list (fn [] (lrand-int 10))
(tag-instruction-erc [:integer :exec] 100)
(untag-instruction-erc 100)
(tagged-instruction-erc 100))
:tag-limit 100
:parent-selection :tournament
:tournament-size 3
:genetic-operator-probabilities {:alternation 0.5
:uniform-mutation 0.4
:uniform-close-mutation 0.1}
You can’t perform that action at this time.