You need an error function, which gets complicated if you’re using one of the software problems, since they use different training cases each time they are initialized. You can create a new error function which will use new training cases easily enough, which may or may not be good enough for your application depending on what you’re trying to simplify. For example, with the Count Odds problem, the following creates an error function:
(count-odds-error-function count-odds-data-domains)
After that, its pretty easy. I grabbed a genome from a run and simplified it using the following:
(use 'clojush.translate)
(use 'clojush.simplification)
(def genome '({:instruction integer_lt, :close 0} {:instruction integer_mod, :close 0} {:instruction integer_add, :close 0} {:instruction exec_yankdup, :close 0} {:instruction vector_integer_eq, :close 1} {:instruction exec_stackdepth, :close 0} {:instruction boolean_dup, :close 1} {:instruction vector_integer_contains, :close 0} {:instruction exec_pop, :close 0} {:instruction exec_flush, :close 1} {:instruction vector_integer_nth, :close 0} {:instruction boolean_swap, :close 0} {:instruction vector_integer_shove, :close 4} {:instruction in1, :close 1} {:instruction vector_integer_concat, :close 0} {:instruction boolean_yankdup, :close 0} {:instruction vector_integer_rot, :close 0} {:instruction boolean_yank, :close 0} {:instruction vector_integer_subvec, :close 0} {:instruction integer_min, :close 0} {:instruction integer_gte, :close 0} {:instruction in1, :close 0} {:instruction integer_rot, :close 0} {:instruction exec_stackdepth, :close 0} {:instruction integer_sub, :close 0} {:instruction integer_rot, :close 0} {:instruction vector_integer_emptyvector, :close 0} {:instruction vector_integer_emptyvector, :close 0} {:instruction vector_integer_dup, :close 0} {:instruction -644, :close 0} {:instruction integer_yank, :close 0} {:instruction boolean_flush, :close 0} {:instruction integer_min, :close 0} {:instruction integer_dup, :close 0} {:instruction integer_stackdepth, :close 1} {:instruction integer_div, :close 0} {:instruction integer_mult, :close 0} {:instruction vector_integer_nth, :close 0} {:instruction exec_dup, :close 0} {:instruction vector_integer_eq, :close 0} {:instruction vector_integer_pop, :close 0} {:instruction exec_do*vector_integer, :close 0} {:instruction integer_add, :close 0} {:instruction vector_integer_first, :close 2} {:instruction boolean_yankdup, :close 0} {:instruction in1, :close 0} {:instruction boolean_pop, :close 3} {:instruction integer_dec, :close 0} {:instruction boolean_and, :close 0} {:instruction in1, :close 0} {:instruction integer_shove, :close 0} {:instruction in1, :close 0} {:instruction vector_integer_yank, :close 2} {:instruction 3, :close 0} {:instruction exec_k, :close 0} {:instruction integer_sub, :close 0} {:instruction integer_mult, :close 0} {:instruction integer_add, :close 0} {:instruction boolean_stackdepth, :close 1} {:instruction in1, :close 1} {:instruction vector_integer_concat, :close 0} {:instruction exec_while, :close 0} {:instruction exec_do*vector_integer, :close 0} {:instruction vector_integer_occurrencesof, :close 2} {:instruction in1, :close 0} {:instruction vector_integer_last, :close 0} {:instruction in1, :close 0} {:instruction vector_integer_yank, :close 1} {:instruction 1, :close 0} {:instruction exec_yankdup, :close 0} {:instruction vector_integer_reverse, :close 0} {:instruction integer_mult, :close 0} {:instruction vector_integer_nth, :close 0} {:instruction integer_add, :close 1} {:instruction boolean_invert_second_then_and, :close 1} {:instruction vector_integer_indexof, :close 0} {:instruction vector_integer_replacefirst, :close 0} {:instruction boolean_not, :close 0} {:instruction exec_while, :close 0} {:instruction integer_swap, :close 0} {:instruction boolean_yank, :close 0} {:instruction tagged_383, :close 0} {:instruction exec_stackdepth, :close 0} {:instruction vector_integer_swap, :close 0} {:instruction vector_integer_concat, :close 0} {:instruction exec_while, :close 0} {:instruction exec_do*vector_integer, :close 0} {:instruction tagged_441, :close 2} {:instruction boolean_invert_second_then_and, :close 0} {:instruction vector_integer_nth, :close 0} {:instruction boolean_eq, :close 2} {:instruction vector_integer_first, :close 0} {:instruction in1, :close 0} {:instruction integer_empty, :close 1} {:instruction exec_pop, :close 0} {:instruction vector_integer_emptyvector, :close 0} {:instruction boolean_flush, :close 1} {:instruction 2, :close 1} {:instruction exec_stackdepth, :close 0} {:instruction integer_pop, :close 0} {:instruction integer_mod, :close 0} {:instruction in1, :close 1} {:instruction boolean_pop, :close 0} {:instruction vector_integer_dup, :close 0} {:instruction integer_mult, :close 0} {:instruction boolean_invert_second_then_and, :close 0} {:instruction integer_empty, :close 0} {:instruction vector_integer_empty, :close 0} {:instruction integer_mult, :close 1} {:instruction integer_add, :close 0} {:instruction integer_sub, :close 1} {:instruction -644, :close 1} {:instruction boolean_flush, :close 0} {:instruction vector_integer_swap, :close 0} {:instruction exec_do*times, :close 1} {:instruction exec_swap, :close 2} {:instruction 4, :close 3} {:instruction vector_integer_conj, :close 0} {:instruction integer_yank, :close 1} {:instruction vector_integer_length, :close 0} {:instruction boolean_flush, :close 0} {:instruction integer_mod, :close 1} {:instruction vector_integer_pop, :close 0} {:instruction boolean_or, :close 0} {:instruction boolean_empty, :close 2})
)
(def program (translate-plush-genome-to-push-program {:genome genome} ;translate takes an individual or a map containing a `:genome`
{:max-points 10000})) ;it also takes the max-points, which is used to make sure the program doesn't get too big. Feel free to just set this to a big number unless you think it might effect the translation.
(auto-simplify-from-program program
(count-odds-error-function count-odds-data-domains)
500 ;number of simplification steps
true ;whether to print a report every X generations
100) ;X = number of generations after which to report
Let me know if any of that is unclear!