Merge branch 'lspector:master' into master

This commit is contained in:
Shuzo Katayama 2021-07-19 16:31:10 -04:00 committed by GitHub
commit c9fe37e227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 56 additions and 35 deletions

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ============================ ; =========== PROBLEM DESCRIPTION ============================
; BASEMENT from PSB2 ; BASEMENT from PSB2

View File

@ -7,7 +7,8 @@
[propeller.push.state :as state] [propeller.push.state :as state]
[clojure.pprint :as pprint] [clojure.pprint :as pprint]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION =============================== ; =========== PROBLEM DESCRIPTION ===============================
; BOUNCING BALLS from PSB2 ; BOUNCING BALLS from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ====================== ; =========== PROBLEM DESCRIPTION ======================
; BOWLING from PSB2 ; BOWLING from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.metrics :as metrics] [propeller.tools.metrics :as metrics]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ===================================== ; =========== PROBLEM DESCRIPTION =====================================
; CAMEL CASE from PSB2 ; CAMEL CASE from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION =============================== ; =========== PROBLEM DESCRIPTION ===============================
; DICE GAME from PSB2 ; DICE GAME from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.metrics :as metrics] [propeller.tools.metrics :as metrics]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ========================= ; =========== PROBLEM DESCRIPTION =========================
; FIZZ BUZZ from PSB2 ; FIZZ BUZZ from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ========================= ; =========== PROBLEM DESCRIPTION =========================
; FUEL COST from PSB2 ; FUEL COST from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION =============================== ; =========== PROBLEM DESCRIPTION ===============================
; GCD [GREATEST COMMON DIVISOR] from PSB2 ; GCD [GREATEST COMMON DIVISOR] from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ============================ ; =========== PROBLEM DESCRIPTION ============================
; LUHN from PSB2 ; LUHN from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.metrics :as metrics] [propeller.tools.metrics :as metrics]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ============================= ; =========== PROBLEM DESCRIPTION =============================
; MIDDLE CHARACTER from PSB2 ; MIDDLE CHARACTER from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ============================= ; =========== PROBLEM DESCRIPTION =============================
; PAIRED DIGITS from PSB2 ; PAIRED DIGITS from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION =============================== ; =========== PROBLEM DESCRIPTION ===============================
; DICE GAME from PSB2 ; DICE GAME from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION =============================== ; =========== PROBLEM DESCRIPTION ===============================
; SNOW DAY from PSB2 ; SNOW DAY from PSB2

View File

@ -5,7 +5,8 @@
[propeller.utils :as utils] [propeller.utils :as utils]
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ================================ ; =========== PROBLEM DESCRIPTION ================================
; SOLVE BOOLEAN from PSB2 ; SOLVE BOOLEAN from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.metrics :as metrics] [propeller.tools.metrics :as metrics]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ============================== ; =========== PROBLEM DESCRIPTION ==============================
; SPIN WORDS from PSB2 ; SPIN WORDS from PSB2

View File

@ -6,7 +6,8 @@
[propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.push.utils.helpers :refer [get-stack-instructions]]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.metrics :as metrics] [propeller.tools.metrics :as metrics]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ========================= ; =========== PROBLEM DESCRIPTION =========================
; SQUARE DIGITS from PSB2 ; SQUARE DIGITS from PSB2

View File

@ -7,7 +7,8 @@
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.tools.metrics :as metrics] [propeller.tools.metrics :as metrics]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ========================= ; =========== PROBLEM DESCRIPTION =========================
; SUBSTITUTION CIPHER from PSB2 ; SUBSTITUTION CIPHER from PSB2

View File

@ -7,7 +7,8 @@
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.tools.metrics :as metrics] [propeller.tools.metrics :as metrics]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
; =========== PROBLEM DESCRIPTION ============================= ; =========== PROBLEM DESCRIPTION =============================
; TWITTER from PSB2 ; TWITTER from PSB2

View File

@ -3,7 +3,8 @@
[propeller.push.interpreter :as interpreter] [propeller.push.interpreter :as interpreter]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.tools.math :as math] [propeller.tools.math :as math]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
(defn- target-function (defn- target-function
"Target function: f(x) = x^3 + x + 3" "Target function: f(x) = x^3 + x + 3"

View File

@ -2,7 +2,8 @@
(:require [propeller.genome :as genome] (:require [propeller.genome :as genome]
[propeller.push.interpreter :as interpreter] [propeller.push.interpreter :as interpreter]
[propeller.push.state :as state] [propeller.push.state :as state]
[propeller.gp :as gp])) [propeller.gp :as gp]
#?(:cljs [cljs.reader :refer [read-string]])))
;; ============================================================================= ;; =============================================================================
;; String classification ;; String classification

View File

@ -2,7 +2,8 @@
(:require [propeller.genome :as genome] (:require [propeller.genome :as genome]
[propeller.push.interpreter :as interpreter] [propeller.push.interpreter :as interpreter]
[propeller.push.state :as state] [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-vars 100) ;10) ;100) ;1000)
(def num-inputs 50) ;5) ; 50) ;500) (def num-inputs 50) ;5) ; 50) ;500)

View File

@ -113,21 +113,21 @@
;; :integer. Otherwise, return nil" ;; :integer. Otherwise, return nil"
(defn get-literal-type (defn get-literal-type
[data] [data]
(let [literals {:boolean (fn [thing] (or (true? thing) (false? thing))) (let [literals [[:boolean (fn [thing] (or (true? thing) (false? thing)))]
:char char? [:integer integer?]
:float float? [:float float?]
:integer integer? [:string string?]
:string string? [:char char?]
:vector_boolean (fn [thing] (and (vector? thing) [:vector_boolean (fn [thing] (and (vector? thing)
(or (true? (first thing)) (or (true? (first thing))
(false? (first thing))))) (false? (first thing)))))]
:vector_float (fn [thing] (and (vector? thing) [:vector_float (fn [thing] (and (vector? thing)
(float? (first thing)))) (float? (first thing))))]
:vector_integer (fn [thing] (and (vector? thing) [:vector_integer (fn [thing] (and (vector? thing)
(integer? (first thing)))) (integer? (first thing))))]
:vector_string (fn [thing] (and (vector? thing) [:vector_string (fn [thing] (and (vector? thing)
(string? (first thing)))) (string? (first thing))))]
:generic-vector (fn [thing] (= [] thing))}] [:generic-vector (fn [thing] (= [] thing))]]]
(first (for [[stack function] literals (first (for [[stack function] literals
:when (function data)] :when (function data)]
stack)))) stack))))