commit
db743db32b
@ -6,7 +6,8 @@
|
||||
[propeller.push.utils.helpers :refer [get-stack-instructions]]
|
||||
[propeller.push.state :as state]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION ============================
|
||||
; BASEMENT from PSB2
|
||||
|
@ -7,7 +7,8 @@
|
||||
[propeller.push.state :as state]
|
||||
[clojure.pprint :as pprint]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION ===============================
|
||||
; BOUNCING BALLS from PSB2
|
||||
|
@ -7,7 +7,8 @@
|
||||
[propeller.push.state :as state]
|
||||
[clojure.pprint :as pprint]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION ======================
|
||||
; BOWLING from PSB2
|
||||
|
@ -7,7 +7,8 @@
|
||||
[propeller.push.state :as state]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.tools.metrics :as metrics]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION =====================================
|
||||
; CAMEL CASE from PSB2
|
||||
|
@ -7,7 +7,8 @@
|
||||
[propeller.push.state :as state]
|
||||
[clojure.pprint :as pprint]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION ===============================
|
||||
; DICE GAME from PSB2
|
||||
|
@ -7,7 +7,8 @@
|
||||
[propeller.push.state :as state]
|
||||
[clojure.pprint :as pprint]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION =========================
|
||||
; FUEL COST from PSB2
|
||||
|
@ -7,7 +7,8 @@
|
||||
[propeller.push.state :as state]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.tools.metrics :as metrics]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION =============================
|
||||
; MIDDLE CHARACTER from PSB2
|
||||
|
@ -7,7 +7,8 @@
|
||||
[propeller.push.state :as state]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.tools.metrics :as metrics]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION =========================
|
||||
; SUBSTITUTION CIPHER from PSB2
|
||||
|
@ -7,7 +7,8 @@
|
||||
[propeller.push.state :as state]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.tools.metrics :as metrics]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
; =========== PROBLEM DESCRIPTION =============================
|
||||
; TWITTER from PSB2
|
||||
|
@ -3,7 +3,8 @@
|
||||
[propeller.push.interpreter :as interpreter]
|
||||
[propeller.push.state :as state]
|
||||
[propeller.tools.math :as math]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
(defn- target-function
|
||||
"Target function: f(x) = x^3 + x + 3"
|
||||
|
@ -2,7 +2,8 @@
|
||||
(:require [propeller.genome :as genome]
|
||||
[propeller.push.interpreter :as interpreter]
|
||||
[propeller.push.state :as state]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
;; =============================================================================
|
||||
;; String classification
|
||||
|
@ -2,7 +2,8 @@
|
||||
(:require [propeller.genome :as genome]
|
||||
[propeller.push.interpreter :as interpreter]
|
||||
[propeller.push.state :as state]
|
||||
[propeller.gp :as gp]))
|
||||
[propeller.gp :as gp]
|
||||
#?(:cljs [cljs.reader :refer [read-string]])))
|
||||
|
||||
(def num-vars 100) ;10) ;100) ;1000)
|
||||
(def num-inputs 50) ;5) ; 50) ;500)
|
||||
|
@ -113,21 +113,21 @@
|
||||
;; :integer. Otherwise, return nil"
|
||||
(defn get-literal-type
|
||||
[data]
|
||||
(let [literals {:boolean (fn [thing] (or (true? thing) (false? thing)))
|
||||
:char char?
|
||||
:float float?
|
||||
:integer integer?
|
||||
:string string?
|
||||
:vector_boolean (fn [thing] (and (vector? thing)
|
||||
(let [literals [[:boolean (fn [thing] (or (true? thing) (false? thing)))]
|
||||
[:integer integer?]
|
||||
[:float float?]
|
||||
[:string string?]
|
||||
[:char char?]
|
||||
[:vector_boolean (fn [thing] (and (vector? thing)
|
||||
(or (true? (first thing))
|
||||
(false? (first thing)))))
|
||||
:vector_float (fn [thing] (and (vector? thing)
|
||||
(float? (first thing))))
|
||||
:vector_integer (fn [thing] (and (vector? thing)
|
||||
(integer? (first thing))))
|
||||
:vector_string (fn [thing] (and (vector? thing)
|
||||
(string? (first thing))))
|
||||
:generic-vector (fn [thing] (= [] thing))}]
|
||||
(false? (first thing)))))]
|
||||
[:vector_float (fn [thing] (and (vector? thing)
|
||||
(float? (first thing))))]
|
||||
[:vector_integer (fn [thing] (and (vector? thing)
|
||||
(integer? (first thing))))]
|
||||
[:vector_string (fn [thing] (and (vector? thing)
|
||||
(string? (first thing))))]
|
||||
[:generic-vector (fn [thing] (= [] thing))]]]
|
||||
(first (for [[stack function] literals
|
||||
:when (function data)]
|
||||
stack))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user