Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6b281c
commit deb4eb9
Showing
3 changed files
with
114 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Plush Genomes / Epigentics | ||
|
||
> In a change from previous versions of PushGP, the most recent version of Clojush | ||
does not evolve Push programs directly, but instead uses a separate linear genome representation | ||
that we translate into Push programs prior to execution. The new Plush | ||
genomes are linear sequences of instructions that may have one or more epigenetic | ||
markers attached to each instruction. The epigenetic markers affect the translation of | ||
the Plush genomes into Push programs. For example, the silent marker is a boolean | ||
that tells whether a particular instruction will appear in the translated program. | ||
|
||
[- Tom Helmuth](https://web.cs.umass.edu/publication/docs/2015/UM-CS-PhD-2015-005.pdf) | ||
|
||
A Plush genome looks like this: | ||
|
||
```clojure | ||
({:close 1, :silent false, :instruction code_frominteger} {:close 0, :silent false, :instruction genome_yank} {:close 0, :silent false, :instruction float_eq} {:close 0, :silent false, :instruction code_size} {:close 0, :silent false, :instruction float_max}) | ||
``` | ||
|
||
Look at the [`translate.clj` tests](./test/clojush/midje/translate.clj) for | ||
some examples of how they are translated. Also check out the docs | ||
for the | ||
[`clojush.translate/var-translate-plush-genome-to-push-program`](https://lspector.github.io/Clojush/clojush.translate.html#var-translate-plush-genome-to-push-program) | ||
function to understand how they are represented in the codebase. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(ns clojush.midje.translate | ||
"Tests for [[clojush.translate/translate-plush-genome-to-push-program]] in document it's behavior | ||
That function takes a [[clojush/indvidual/->individual]]" | ||
(:require [midje.sweet :refer :all] | ||
[clojush.translate :refer [translate-plush-genome-to-push-program]] | ||
[clojush.pushgp.pushgp :refer [reset-globals, push-argmap]] | ||
[clojush.problems.demos.odd-with-uniform-silence-mutation :refer [argmap]])) | ||
|
||
(with-state-changes [(before :contents (reset-globals argmap))] | ||
; choose two instructions to use in our tests. It doesn't | ||
; matter what they are, as long as one operates on the exec stack | ||
; and the other doesn't | ||
(let [exec 'exec_dup | ||
instr 'code_frominteger] | ||
(tabular | ||
(fact "translate-plush-genome-to-push-program" | ||
(translate-plush-genome-to-push-program {:genome ?plush} @push-argmap) => ?push) | ||
?plush ?push | ||
|
||
[] '() | ||
[{:instruction instr, :silent true}] '() | ||
[{:instruction exec, :silent true}] '() | ||
|
||
|
||
[{:instruction exec}, | ||
{:instruction instr}] (list exec (list instr)) | ||
|
||
[{:instruction exec, :close 1}, | ||
{:instruction instr}] (list exec, '(), instr) | ||
|
||
[{:instruction exec}, | ||
{:instruction instr, :close 1} | ||
{:instruction instr}] (list exec, (list instr), instr) | ||
|
||
[{:instruction exec}] (list exec '()) | ||
|
||
|
||
[{:instruction instr}, | ||
{:instruction instr}, | ||
{:instruction exec}] (list instr, instr, exec '()) | ||
|
||
|
||
[{:instruction exec}, | ||
{:instruction exec}, | ||
{:instruction instr}] (list exec, (list exec (list instr))) | ||
|
||
[{:instruction exec}, | ||
{:instruction exec :close 2}, | ||
{:instruction instr}] (list exec, (list exec, '() ), instr) | ||
|
||
[{:instruction instr :close 1}] instr | ||
|
||
|
||
))) |