Robust Physical Computation

Table of Contents

meta

Robust Physical Computation

topics

pondering

Over the course of listening to the research plan's of my lab-mates, I've got some general IXM thoughts

  • George Bezerra is working with networks on chip. Many of the XIM issues (e.g. communication between a grid of processing elements, distributed memory, etc…) have direct counterparts in the research of these new large chips
    • schemas for communicating between boards/processors (e.g. "Dimension-Order Routing)
    • cache coherence (both "snooping" and "directory")
    • a variety of scheduling algorithms for coordinating computation distributed in both time (dependencies) and space (across separate processors)
  • In terms of slightly different hardware for the IXM, I wonder what the smallest feasible unit of IXM could be – meaning smallest board, least amount of functionality, cheapest processor, s.t. boards could still connect and collaborate, (e.g. microcontrollers, Digital Signal Processor with some generalizable functionality)

open source hard ware

remote board reset – rescue from blink code

SET_REFLEX_FLAGS(RF_OKAY_NEW_GUY); // but this in setup(), blink 10 times then reboot
SET_REFLEX_FLAGS(RF_KARMIC_REBIRTH); // if recovering from a blink code, burn from a neighbor

color/video e-paper – would be good w/IXM

http://pixelqi.com/

they have DIY netbook transition kits

communication system Net

first_thoughts.pdf

  • name could possibly be Net
  • FGR = functional gradient routing
  • build upon existing reflexes – Net.broadcast could make one of your reflexes available to anyone inside of your gradient
  • virtual faces that hyper-jump to other boards

profiling information

  • there's a profiling example in AdvancedExamples
  • looks pretty easy to use
  • recall Profile.begin() after reporting if you don't want cumulative stats

track buffer status – am I overflowing?

SFBSerial.h has some new measures

  • [input/output]Buffer[used/free]
  • brokenPackets

mobile software agents

implement some simple virtual machine

  • RPN
  • bytecodes

processes carry around a little stack or something that they can unpack when they land on a new board

specialized processors – heterogeneous environment

with respect to mobile processes

  • cell processor (play station)
  • road runner super-computer has many different types of processors
  • biological cells all start with same DNA then specialize – IXM w/same initial code, then specialize

display

sparkfun

  • 3.3 volts
  • 16x2 Character LCD
  • serial display (much easier)

distributed problem sets

  • evolve solutions to the four coloring problem distributed over the boards
  • more general – any graph problem (e.g. Hamiltonian path) could be distributed over the boards – which themselves form a graph, or more appropriately the edges in a hypergraph which shares vertices with the graph of the problem
    • would need a way of mapping vertices to IXMs and edges through IXM connections…
    • could dynamically change the number of IXMs devoted to subgraphs as needed by the problem

distributed computation (scheme-splits)

  • referential parsimony
  • following your tail up through the call stack, caching, make space requirements reasonable

anything that's arduino-ready we can talk to

wii remote

johnny lee, has done some wii remote stuff

task [44/44]

DONE persistence/future of RPC/IXM

DEADLINE: 2010-05-10 Mon

2: A discussion topic for Monday:

           How can RPC/IXMish have a long life
           and avoid the fate of the vanishing
           'Jelly Bean Machine'?

       I'm looking for any and everything
       from brainstorming and out of the box
       ideas to practical and near term
       actions.

       Samples:
         - Expectation management
         - Delay confronting incumbent
         - Steady science and engineering
         - Multiple thrusts/funding sources
         - New hardware generations
         - Demos, videos, theme comic book,
             product placements, endorsements..

DONE tell sam about Euclidean TSP algorithm

  • divide space up into grids, finding a crossing across grids
  • due to Aurora
  • portals or border crossings – the more of them you make, the better the approximation

DONE do some writing

DEADLINE: 2010-05-10 Mon
churn out some of the text that doesn't depend on results.

DONE something up with the boards?

sfbpush
Ln Wed Apr 28 23:54:01 2010 [Running in server mode]
Ln Wed Apr 28 23:54:01 2010 [Loaded EMS:PEC/20100429-55350 Size=73240 CS=13319D7-D38392F Copyright=GPL V3]
Ln Wed Apr 28 23:54:02 2010 [North baud rate set to 115200]
Ln Wed Apr 28 23:54:10 2010 [North baud rate set to 9600]
Ln Wed Apr 28 23:54:10 2010 [North baud rate set to 115200]
Ln Wed Apr 28 23:54:11 2010 [North seeking arch 2 code, responding]
Ln 8.261 Best offer so far: EMS:PEC/20100429-55350 (size 73236) from North 1L6JUGI/SFBPRG
c (1,0) 0.00 0.00 7120 471.65 736.25 10.00 10.00 -1.00 55+xs*55+ys*+ +534084/-0+4x/6-*80y23y29x/y-96/+x-y*89+y3+/+4+y/
c (2,3) 0.00 0.00 7120 476.42 793.03 10.00 10.00 -1.00 55+xs*55+ys*+ 4*+15x2x1y/*74+/8840-y+5y9x/y-96/+x-*48+y3+/++y/
c (1,3) 0.00 0.00 7120 477.67 764.33 10.00 10.00 -1.00 55+xs*55+ys*+ 4+74/7y/39*5+80978y9x/y-77/+x-*469+y3+/++y/
Ln 9.758 About to burn: 0/0 bootCount=1222; burnCount=832 (+1); powerOnHours=843; flags=0
Ln Wed Apr 28 23:54:13 2010 [Sending checksum North for 0x10014+32748=DA6A566-CD16DB7B]
Ln Wed Apr 28 23:54:18 2010 [Sending checksum North for 0x18000+32768=5A68A208-C62322E8]
Ln Wed Apr 28 23:54:23 2010 [Sending checksum North for 0x20000+7700=B7496EA9-E9D7245E]
Ln Wed Apr 28 23:54:26 2010 [North burned successfully!]
Ln Wed Apr 28 23:54:29 2010 [North baud rate set to 9600]

DONE simplified polynomials

try something like… (x+1)^k(y+2)^l

DONE begin experimentation

follow through on the TODOs posted up there

  • Parameter lockdown:

     0: Fix # sample points independent of range+dimensionality
     1: Repro tournament==3
     2: Mutation period==100ms 50ms?
     3: Crossover period==500ms
     4: Sharing period==10000ms
     5: Geometry is line for 1D + grid for 2D

  • Functions:

     1: Matching exactly-matchable functions
           1a: Functions of order n for n=0,1,2,3,4,5
                   3x- xx3** 3333333+++++
           1b: Test them.
                   Question: Discover exact match? How fast?
     2: Approximating non-exactly-matchable functions

     3: f(x,y) 2D inputs s

  • Crossed with:

     All work on all range
     All work on nonoverlapping patches
     All work on overlapping patches
     All work adaptively?

  • Anecdotal samples of varying geometry:

     Line vs D
     Grid vs D

DONE share IXM git repositories on the mailing list

push these to the public mailing list.

CANCELED guile on IXM

compiling guile with

./configure --without-threads --target=arm-linux-gcc --host=arm-linux --prefix=/home/eschulte/guile-arm/

resulting in guile-arm-compile.out

refer to – the cross compilation guide

Cross building Guile =====================================================

Guile can be cross-compiled for Windows using the i586-mingw32msvc
cross-compiler. To do this, you first need to cross-build Guile's
prerequisites - GNU MP and libtool/libltdl (as described above) - and
then cross-build Guile itself.

For each of these steps, configure using an invocation like this:

CPPFLAGS=-I/usr/local/i586-mingw32msvc/include \
LDFLAGS=-L/usr/local/i586-mingw32msvc/lib \
GUILE_FOR_BUILD=/usr/local/bin/guile \
./configure –prefix=/usr/local/i586-mingw32msvc –host=i586-mingw32msvc

Then run `make' - which should complete without any errors - and `sudo
make install'. (`make check' doesn't work when cross-compiling,
because the built DLLs and program cannot be run on GNU/Linux.)

The `GUILE_FOR_BUILD=…' setting is needed because some later steps
of the build process use Guile itself. In the non-cross-compiling
case this is the version of Guile that has just been built. When
cross-compiling, you have to set GUILE_FOR_BUILD to tell the build
where it can find a native version of Guile, to use for these steps.

Cross-compiling for other hosts may also work, using the following
instructions; but this has not been recently tested.

To configure Guile for cross building, for example for Cygwin:

         ./configure –host=i686-pc-cygwin –disable-shared

A C compiler for the build system is required. The default is
"PATH=/usr/bin:$PATH cc". If that doesn't suit it can be specified
with the CC_FOR_BUILD variable in the usual way, for instance

         ./configure –host=m68k-unknown-linux-gnu CC_FOR_BUILD=/my/local/gcc

Guile for the build system can be specified similarly with the
GUILE_FOR_BUILD variable, it defaults to just "guile".

CPPFLAGS=-I/home/eschulte/src/ixm/arm-2008q3/include \
LDFLAGS=-L/home/eschulte/src/ixm/arm-2008q3/lib \
GUILE_FOR_BUILD=/usr/local/bin/guile \
CC_FOR_BUILD=/home/eschulte/src/ixm/arm-2008q3/bin/arm-none-eabi-gcc \
./configure --without-threads --prefix=/usr/local/arm --host=arm-linux --with-gmp=/usr/include/

the above works and successfully compiles an arm guile, however it fails on sketch compilation because it needs gmp, so according to here I may need to also cross-compile

gmp and libltdl

now to cross-compile gmp

configuring with

CPPFLAGS=-I/home/eschulte/src/ixm/arm-2008q3/include \
LDFLAGS=-L/home/eschulte/src/ixm/arm-2008q3/lib \
CC_FOR_BUILD=/home/eschulte/src/ixm/arm-2008q3/bin/arm-none-eabi-gcc \
./configure --prefix=/usr/local/arm --host=arm-linux

results in

configure: error: Specified CC_FOR_BUILD doesn't seem to work

however removing

CC_FOR_BUILD=/home/eschulte/src/ixm/arm-2008q3/bin/arm-none-eabi-gcc

results in a successful configuration, but a failed build with

tmp-add_n.s: Assembler messages:
tmp-add_n.s:58: Error: no such instruction: `stmfd r13!,{r8,r9,r14}'
tmp-add_n.s:59: Warning: `r3' is not valid here (expected `(%esi)')
tmp-add_n.s:59: Warning: `r3' is not valid here (expected `(%edi)')
tmp-add_n.s:59: Error: too many memory references for `movs'
tmp-add_n.s:60: Error: no such instruction: `bcc .Lskip1'
tmp-add_n.s:61: Error: no such instruction: `ldr r12,[r1],'
tmp-add_n.s:62: Error: no such instruction: `ldr r14,[r2],'

other scheme options

DONE write up an actual textual abstract

DEADLINE: 2010-04-19 Mon

  • actually write this up in text with sentences
  • email back and forth with Ackley over this week

DONE select functions

DEADLINE: 2010-04-19 Mon
(see notes, create a variety of polynomials of increasing degrees)

thank you wikipedia

GA of a CA

got code from Tyler, documentation is up at http://www.cs.unm.edu/~ltrush/cs523/assign2/documentation/

see data/ca/

DONE read paper

DEADLINE: 2010-04-12 Mon
autonomous_robot.pdf

DONE experimental setup/schedule

DEADLINE: 2010-04-12 Mon

DONE last week for code tweaks, tangling for boards

DEADLINE: 2010-04-12 Mon
finish all the code tweaking

DONE outline, abstract, title

DEADLINE: 2010-04-12 Mon
see the other todo

DONE SFBNet sketch

DEADLINE: 2010-04-12 Mon
write up an SFBNet sketch

Propagator for square root via the heron step.

not general, but does work.

DONE reverse representation strings on reporting

DEADLINE: 2010-04-12 Mon

done, although apparently wrapping this up in a function is very difficult in C…

DONE mutation is length sensitive

  • mutation should be dependent on the length, so that individuals can't grow as a defense against having their sensitive parts mutated.

DONE less converging

I suspect your population is horribly
converged, so the search is amounting to
an expensive stochastic hillclimb.

Some things to maybe try:

(A) Be less elitist:

       (1) On each 'generation', generate
               only one or a handful of new
               genomes – perhaps up to 10 max
               – based on parents selected by
               tournament as you do now.

       (2) Insert the offspring into
               uniformly-randomly-chosen
               population slots – with no
               'death tournaments' –so there's
               no elitism and no guarantee of
               getting into the next generation.

Try just that first, keeping everything
else the same, and see if anything
changes. If things still suck, maybe
try:

(B) Extend mutation to encompass:
       (1) Random change to existing spot
               (what you have now)
       (2) Random insertion of a single new
               character at a random position.
               (If result exceeds max length,
                 then truncate the last character)
       (3) Random deletion of a single
               character at a random position.
               If the genome is then 0, then
               insert one random character.

       On a given mutation, perhaps do (1)
       50% of the time, (2) 25% of the time,
       and (3) 25% of the time.

DONE parameter tuning w/Ackley

DEADLINE: 2010-04-05 Mon 14:00

DONE instrument population for collecting uniqueness statistics

should report the number of people who have the most popular score.

DONE initial

done with the naive implementation however this isn't sufficient, because the two individuals are actually the same if they have the same rpn string. for now as a quick fix, I'm just going to run this on the float scores, rather than the representations…

DONE stochastic tests for operators [3/3]

DEADLINE: 2010-04-05 Mon

  • [X] crossover
  • [X] mutations
  • [X] tournaments

DONE ensure y works

DEADLINE: 2010-04-05 Mon
and graph appropriately

DONE get it to work

DEADLINE: 2010-04-05 Mon

meeting with Ackley about this tomorrow

DONE ping Dave about notes up on the class site

DEADLINE: 2010-03-12 Fri

DONE READ: Gerald Jay Sussman is awesome

DEADLINE: 2010-03-22 Mon
some really relevant and generally sweet looking papers by Mr. Sussman

we should read both of these, they look awesome

The art of the Propagator

for modern output from the constraint community see this thesis work http://www.ps.uni-saarland.de/Papers/abstracts/tackDiss.html

  • combines expression and constraint programming
  • autonomous machine communicating through "cells"
  • propagator network computational metaphor for exploring the consequences of allowing places to accept information from multiple sources

elements

cell
communication mechanisms
propagator
machines connected by cells

lots of scheme code implementing propagators…

  • partial information
    a nice examples where a cell contains the answer to a question "how tall is a building", and the cell is populated through different techniques, one of which supplies an upper bound, and one a lower bound.
  • multidimensional computation

DONE grid testing paper

DEADLINE: 2010-03-08 Mon
grid-testing.pdf

  • use untrusted heterogeneous grid of computers for testing applications
  • unit tests are embarrassingly parallel (why embarrassing)
  • built on top of the globus toolkit
  • what
    Moreover, an adaptive scheduling scheme using swarm intelligence is
    employed to efficiently use the computational resources    
    
  • master/slave setup for executing tasks taken from a bag of tasks

ant colony optimization

  • I don't think ant colonies actually are computational environments…
  • looks like it takes the ant metaphor very seriously
    • scout – detect new grid services
    • worker – match tasks with grid servers
    • collector – retrieve partial testing results (seems like this guy should be merged with the worker)
    • cleaner – helps to maintain available grid resource table
    • queen – produces specialized ants

probability \(q_i\) of selecting a grid server $i$ for a testing task is

$$q_i = \frac{p_i}{\sum^{n}_{j=1}{P_j}}$$

where \(P_i\) is the value of the grid server $i$, and n is the total number of available grid servers, so each server is selected with probability proportional to its pheromone level.

  • when a server completes a task its pheromone level is increased
  • bonus for the guy who completes the most tasks
  • pheromone's evaporate
  • remove servers with pheromone levels below threshold

dealing with untrustworthy nodes

  • redundancy
  • check pointing
  • separate execution and result comparison
  • verification code injection

DONE unit tests for evolution stuff

DEADLINE: 2010-03-22 Mon

DONE outline

paper.org

now in the main file in ~/research/ixm/

DONE read robustness paper

DEADLINE: 2010-03-01 Mon
robust-systems.pdf

DONE denser sampling

DEADLINE: 2010-03-01 Mon
like 10 to 20 per unit

DONE parse experimental log files resulting from experimenter.clj

(ns exp-parser
  (:require (clojure.contrib (duck-streams :as f) (command-line :as c) (math :as m)))
  (:import (java.io InputStreamReader OutputStreamWriter BufferedReader)
           (clojure.lang LineNumberingPushbackReader)
           java.util.Date java.text.SimpleDateFormat)
  (:use [clojure.main :only (repl)]
        clojure.contrib.seq-utils))

(defn read-log [in-path]
  "Read a log file parsing each line w/regex.  Note this remove
non-collector lines, like board chatter, and mutating too fast
complaints."
  (remove #(not %)
          (map #(re-matches
                 #"^(\d+)\s+\(([-\d]+),([-\d]+)\)\s+(.+):\s+(.*)$" %)
               (f/read-lines in-path))))

(defn by-board [log]
  "Split up the output of read-log into a hash keyed by board
location."
  (reduce
   #(assoc %1
      (format "(%s,%s)" (first %2) (second %2))
      (map
       (fn [line] (assoc {}
                    :wall (Integer/parseInt (nth line 1))
                    :type (nth line 4) :what (nth line 5)))
       (remove (fn [ln] (not (= %2 ))) log)))
   {}
   '(("-3" "0") ("-2" "0") ("-1" "0") ("0" "0")
     ("3" "0") ("2" "0") ("1" "0"))))

(defn lines-to-hashes [log]
  (map
   (fn [line]
     (assoc {}
       :x (Integer/parseInt (nth line 2))
       :y (Integer/parseInt (nth line 3))
       :wall (Integer/parseInt (nth line 1))
       :type (nth line 4)
       :what (nth line 5)))
   log))

(defn by-loop [col]
  "Compact a board's output lines into hash maps by which loop
generated them."
  (map
   (fn [cols]
     (let [hmps (apply concat cols)]
       (reduce #(assoc %1
                  :wall (:wall %2)
                  (keyword (:type %2)) (:what %2)) {} hmps)))
   (let [sec? (fn [line] (= (:type line) "seconds"))]
     (partition 2 (partition-by
                   sec? (drop-while (complement sec?) col))))))

(c/with-command-line (rest *command-line-args*)
  "Parse output of experimenter.clj, pass paths to log files as arguments"
  [[board "print out results for a particular board, grouped by loop"]
   [key "print out the value of the given key whenever it appears"]
   others]
  (let [path (first others)
        log (read-log path)]
    ;; print out results for a particular board, grouped by loop
    (when board
      (let [boards (by-board log)]
        (println (pr-str (assoc {} board (by-loop (get board boards)))))))
    ;; print out the values of key whenever it appears in any board
    (when key
      (let [log (lines-to-hashes log)]
        (doseq [line log]
          (when (= (:type line) key)
            (println
             ;; convert wall time to hh:mm:ss
             (let [h (m/floor (/ (/ (:wall line) 1000)
                                 3600))
                   m (m/floor (/ (- (/ (:wall line) 1000)
                                    (* h 3600))
                                 60))
                   s (m/round (- (- (/ (:wall line) 1000)
                                    (* h 3600))
                                 (* m 60)))]
               (format "%02d:%02d:%02d\t%d,%d\t%s"
                       h m s
                       (:x line) (:y line)
                       (:what line))))))))))

DONE start some real experiments

DEADLINE: 2010-03-01 Mon
sectioned landscape vs. interleaved vs. overlap vs. not overlap vs. malleable

graph best in grid vs. wall-clock time

best fitness's

distributed

overlapping

annealing

interleaved

best individuals

  • distributed
    73*x11/+4/++51xxx13*y/++6y5*6/6-+xx+*
    
  • overlapping
    x67-*021y-8362734-+x0-211/563y++/63y++9-2*x*
    
  • annealing
    675332x9y/50+*-/*637*y6-76yy/2y-2yx**
    
  • interleaved
    +*493*x24yx95/*y*
    
    -2"72+1117/42597+/97+//414y0+/+843yy13/x+/+*4x+/""((3 * (y + (y / ((1 / 3) + x)))) / (4 + x))"
    -1"14/+3x8695/x3-95/x395/x32/+x**y*""(((9 / 5) * ((x + (3 / 2)) * x)) * y)"
    0"+*493*x24yx95/*y*""((x * (9 / 5)) * y)"
    1"//6072*x7*5/3623*84y9x+x+/yx*x*x*4/-y+""(((y / ((9 + x) + x)) - ((((y * x) * x) * x) / 4)) + y)"
    2"2yx80656y*yx/1x00yx/1/15x-//x/x52-//x/x/y-""((((((((y / x) / 1) / (1 / (5 - x))) / x) / (x / (5 - 2))) / x) / x) - y)"
    3"39y/8-/-1y-/x4y8x-/-/15-2y40y40+x-/4y*x/-""((y / ((4 + 0) - x)) - ((4 * y) / x))"

live display of variable fitness landscapes

Write a simple script to scroll generate graphs of the best functions of each board on its changing range.

(require ((clojure.contrib
           (duck-streams :as f)
           (shell-out :as s))))


(defn ingest
  "Organize output from boards" [path]
  (let [boards (ref {})]
    (dosync
     (alter boards assoc
            ))))

DONE fitness-landscape scaling

at some interval my fitness is reset to the product of…

fitness_landscape_range = fitness_landscape_range mean_fitness/average(neighbor_mean_fitness)

see malleable

graph partition

Distribute a graph over a set of boards s.t. the number of nodes per board is as even as possible, and edges are stretched as little as possible.

this could look good with a clojure-interface

representation

how to represent the graph?

  • should be possible to represent only the relevant subgraph onboard – i.e. the whole graph shouldn't need to exist on every board
  • edges or nodes, either each board holds a list of its nodes, along with the nodes to which they are connected, or each board holds a list of the edges which have one end in themselves

moving a node

how to move a node between two boards – need to update all of the edges touching that node

CANCELED clojure-interface – simulation and visualization

  • State "CANCELED" from "HOLD" 2010-02-22 Mon 16:13
    not right now, don't simulate!

Since its naturally multi-threaded it could be a good way to simulate a collection of boards. If done well then the visualization for the simulated boards could also be used to visualize data collected from a real set of boards.

visualization takes data in collector form

started doing stuff in the gui directory under research/ixm

DONE collector release

  1. clean it up
  2. push it up somewhere – maybe to repo.or.cz

add profiling to evolution

DONE overlapping fitness[3/3]

DEADLINE: 2010-02-22 Mon

  • overlapping fitness
  • free rides for new guys
  • [X] got it running
  • [X] need to implement free ride
  • [X] analyze results – gnuplots with multiple graphs each over different domains

see overlapping-2d-distributed-fitness

DONE clojure interface wrapper – batch and repl

wrap sfbprog in obj which can print to screen

so this actually works… async reading from a command

(defmacro while-let
  "Like while, but uses when-let instead of when."
  [test & body]
  `(loop []
     (when-let ~test
       ~@body
       (recur))))

(defmacro in-cmd
  [cmd & body]
  `(let [proc# (.exec (Runtime/getRuntime) (into-array ~cmd))]
     (with-open [stdout# (BufferedReader. (InputStreamReader. (.getInputStream proc#)))
                 proc-input# (OutputStreamWriter. (.getOutputStream proc#))]
       (def proc-in proc-input#)
       (binding [*in* stdout#] ~@body))))

(let [out *out*]
  (future
   (binding [*out* out]
     (in-cmd (list "guile")
             (while-let [line (read-line)] (println line))))))

(binding [*out* proc-in] (println "(+ 1 2 3 4)"))

expose all of this through a ref @tribe

(use 'clojure.contrib.except)

(def tribe {:sfbprog-cmd "sfbprog"
            :usb-dev "/dev/ttyUSB0"})

(def repl-out *out*)
(def tribe-in nil)

(def reflexes {:L repl-print})

(defn repl-print [line]
  (binding [*out* repl-out] (println line)))

(defn tribe-print [line]
  (when (nil? tribe-in) (throwf "not connected to tribe"))
  (binding [*out* tribe-in] (println line)))

(defn dump [line])

(defn connect []
  (future
   (let [proc (.exec (Runtime/getRuntime)
                     (into-array (list (:sfbprog-cmd tribe)
                                       "-n" (:usb-dev tribe) "-S" "-" "-t" "0")))]
     (with-open [stdout (BufferedReader. (InputStreamReader. (.getInputStream proc)))
                 proc-input (OutputStreamWriter. (.getOutputStream proc))]
       (def tribe-in proc-input)
       (binding [*in* stdout]
         (loop [] (when-let [line (read-line)] (react lines))))))))

seems to be working

(ns #^{:author "Eric Schulte",
       :license "GPLV3",
       :doc "interact with an IXM tribe through a Clojure repl"}
  ixm-repl
  (:import (java.io InputStreamReader OutputStreamWriter BufferedReader)
           (clojure.lang LineNumberingPushbackReader))
  (:use [clojure.main :only (repl)]
        clojure.contrib.duck-streams
        clojure.contrib.command-line
        clojure.contrib.except
        clojure.contrib.repl-utils))

(def tribe {:sfbprog-cmd "sfbprog"
            :usb-dev "/dev/ttyUSB0"})

(def repl-out *out*)

(def tribe-in nil)

(defn repl-print [line]
  (binding [*out* repl-out] (println line)))

(defn tribe-print [line]
  (when (nil? tribe-in) (throwf "not connected to tribe"))
  (binding [*out* tribe-in] (println line)))

(defn dump [line])

(def reflexes {:L 'repl-print})

(defn react [line]
  (eval `(~(get reflexes (keyword (subs line 0 1)) 'repl-print) ~line)))

(defn connect []
  (future
   (let [proc (.exec (Runtime/getRuntime)
                     (into-array
                      ;; (list (:sfbprog-cmd tribe)
                      ;;       "-n" (:usb-dev tribe) "-S" "-" "-t" "0")
                      (list "bash")
                      )
                     )]
     (with-open [stdout (BufferedReader. (InputStreamReader. (.getInputStream proc)))
                 proc-input (OutputStreamWriter. (.getOutputStream proc))]
       (def tribe-in proc-input)
       (binding [*in* stdout]
         (loop [] (when-let [line (read-line)] (react line) (recur))))))))

complex parsing of output

(ns experimenter
  (:require (clojure.contrib (duck-streams :as f) (command-line :as c)))
  (:import (java.io InputStreamReader OutputStreamWriter BufferedReader)
           (clojure.lang LineNumberingPushbackReader)
           java.util.Date java.text.SimpleDateFormat)
  (:use [clojure.main :only (repl)]))

(defn message
  [fmt & args]
  (binding [*out* *err*]
    (println (apply format (cons fmt args)))))

(defn reset-and-cycle-resets [since resets counter]
  (dosync (ref-set since (new Date)))
  (message "resetting------------------------------------------")
  (message "%s" (nth resets @counter)) (println (nth resets @counter))
  (message "reset----------------------------------------------")
  (dosync (ref-set counter (mod (inc @counter) (.size resets)))))

(defmacro while-let
  "Like while, but uses when-let instead of when."
  [test & body]
  `(loop []
     (when-let ~test
       ~@body
       (recur))))

(defmacro in-cmd
  [cmd & body]
  `(let [proc# (.exec (Runtime/getRuntime) (into-array ~cmd))]
     (with-open [stdin# (OutputStreamWriter. (.getOutputStream proc#))
                 stdout# (BufferedReader. (InputStreamReader. (.getInputStream proc#)))]
       (binding [*in* stdout# *out* stdin#]
         ~@body))))

(c/with-command-line (rest *command-line-args*)
  "Programmable interaction with IXM grid through sfbprog."
  [[usb-dev "Path to usb device connected to IXM grid" "/dev/ttyUSB0"]
   [sfbprog-cmd "Command used to call sfbprog" "sfbprog"]
   [out-file "file to which results will be saved" "experimenter.log"]
   [repl? "run interactively in a repl -- not yet supported"]
   rest]
  (in-cmd ;; sfbprog -n /dev/ttyUSB0 -S - -t 0
   (list sfbprog-cmd "-n" usb-dev "-S" "-" "-t" "0")
   (if repl?
     ;; interactive
     (message "repl mode is not currently supported")
     ;; batch
     (let [date-formatter (new SimpleDateFormat "dd:HH:mm:ss")
           since (ref (new Date))
           counter (ref 0)
           resets (list "r B:0 y:100 x:700 Y:0 X:14"  ;; interleaved
                        "r B:0 y:100 x:100 Y:0 X:100" ;; sectioned
                        "r B:0 y:100 x:120 Y:0 X:100" ;; sectioned overlap
                        "r B:100000 y:100 x:100 Y:0 X:100" ;; sectioned malleable
                        )]
       (doseq [n (range 10)]
         (message "%d %s" (- 10 n) (read-line))
         (println (format "L test %d" n)))
       (reset-and-cycle-resets since resets counter)
       (while-let
        [line (read-line)]
        ;; normal logging
        ;; (message "%s %s" (.format date-formatter (new Date)) line)
        (message "%d %s" (- (.getTime (new Date)) (.getTime @since)) line)
        ;; check if its time for the next experiment
        (when (> (- (.getTime (new Date)) (.getTime @since)) 14400000)
          (reset-and-cycle-resets since resets counter)))))))

attempt at a ixm repl

(ns experimenter
  (:require (clojure.contrib
             (duck-streams :as f)
             (shell-out :as s)
             (command-line :as c)))
  (:import (java.io InputStreamReader OutputStreamWriter BufferedReader StringWriter)
           (clojure.lang LineNumberingPushbackReader)
           java.util.Date)
  (:use [clojure.main :only (repl)]))

(defmacro while-let
  "Like while, but uses when-let instead of when."
  [test & body]
  `(loop []
     (when-let ~test
       ~@body
       (recur))))

(defmacro in-cmd
  [cmd batch? & body]
  `(let [proc# (.exec (Runtime/getRuntime) (into-array ~cmd))]
     (with-open [stdin# (if ~batch?
                          (OutputStreamWriter. (.getOutputStream proc#))
                          (StringWriter. 200))
                 stdout# (if ~batch?
                           (BufferedReader. (InputStreamReader. (.getInputStream proc#)))
                           (LineNumberingPushbackReader. (InputStreamReader. (.getInputStream proc#))))]
       (binding [*in* stdout# *out* stdin#]
         ~@body))))

(c/with-command-line (rest *command-line-args*)
  "Programmable interaction with IXM grid through sfbprog."
  [[usb-dev "Path to usb device connected to IXM grid" "/dev/ttyUSB0"]
   [sfbprog-cmd "Command used to call sfbprog" "sfbprog"]
   [out-file "file to which results will be saved" "experimenter.log"]
   [repl? "run interactively in a repl, or execute code in this file"]
   rest]
  (println (if repl? "interactive" "batch"))
  (in-cmd ;; sfbprog -n /dev/ttyUSB0 -S - -t 0
   (list sfbprog-cmd "-n" usb-dev "-S" "-" "-t" "0") (not repl?)
   (if repl?
     ;; interactive
     (repl)
     ;; batch
     (while-let
      [line (read-line)]
      (f/spit out-file (apply str (.toString (new Date)) " " line))))))

possibly related clojure library

This could be useful – from the clojure mailing list

Hi all,

some time ago I wrote a simple control library (called "Robust") for
Lego Mindstorms NXT.
Recently I wrote a Clojure wrapper to the Robust library so that it is
possible to write simple control applications for standard Mindstorms'
vehicles directly in Clojure.

The Robust library together with Clojure interface (cljRobust) can be
found at
http://sourceforge.net/projects/robust/

enjoy,
Konrad Kulakowski  

DONE fix collector

DEADLINE: 2010-02-15 Mon

  • just print directly to another face

so it looks like the collector does prefix reporting strings so that they can make it back to the base, so I guess rather than just writing to the outermost face, we'll have to write to some collector-specific face.

Following the makePacketPrinter example from hallucination-example

sent question to Ackley, not sure how to rework this.

I think the virtual face printer is
probably the way to go.  If you can
tolerate applying your prefix early --
right after the previous packet ships,
then its not too hard -- just do the
prefix as part of the println of the
previous.

Something like:

    u8 outputFace = NORTH;  // underlying actual destination face
    u8 vFace;               // virtual face
    const char * prefix = "Lfoo";
    const char * suffix = "etc etc";
    void myprint(u8 face, u8 byte) { facePrintf(outputFace,"%c",byte); }
    void myprintln(u8 face) {
facePrintf(outputFace,"%s\n%s",suffix,prefix); }
    const FacePrinter myPrinter = { myprint, myprintln, 0, 0 };

    void setup() {
     ..
      bool worked = faceFindFreeFace(vFace);
      API_ASSERT_TRUE(worked);
      faceSetPrinter(vFace,&myPrinter);
      facePrintf(vFace,"%s",prefix); // hack in first prefix
     ..
    }

should work, for constant prefix/suffix
anyway.

More complicated approach could have a
'haveSentPrefix' bool that myprint would
check and if clear it would send the
prefix and set the bool, and myprintln
would clear the bool.

That would allow deferring prefix
generation until the moment it is
needed.

The virtual face printer also avoids
the need to burn RAM for another buffer.  

done, pretty much as described above – printing through a virtual face

DONE find a paper

DEADLINE: 2010-02-15 Mon
from-earwigs-to-humans.pdf

DONE reading on HP stuff

DEADLINE: 2010-02-15 Mon

I can't seem to find a proper paper on this, but HP is working on an
interesting and relevant project known as CeNSE (Central Nervous System
for the Earth) that I thought would be worth discussing.

Here's HP's propaganda on the project:

http://www.hpl.hp.com/news/2009/oct-dec/cense.html


And another article specifically discussing their proposed bridge sensor
networks:

http://spectrum.ieee.org/semiconductors/devices/new-sensors-a-step-toward-monitoring-bridges  
  • "deaf, blind, can’t taste, can’t smell and can’t feel" – Reminds me of Rodney Brooks
  • sensors
    • quality through quantity of sensors, if many sensors report an abnormal result you are more likely to believe it

Steps

  1. deploy sensors
  2. collect and aggregate data
  3. process the data
  4. disseminate the results

the memristor is HP's hardware solution

working on an accelerometer for sensing problems in bridges.

CANCELED find a GP conference

  • State "CANCELED" from "STARTED" 2010-02-23 Tue 17:23
    looks like we'll just submit a journal article

here's a good-list of conferences

conferencepaper deadlinenotes
international conference on evolvable systems 2010-03-05 Fri
simulation of adaptive behavior 2010-02-22 Mon
simulated evolution and learning 2010-07-05 Mon
world conference on computational intelligence 2010-03-02 Tuefinal deadline

too late

conferencedeadline
unconventional computation 2010-02-08 Mon
EuroGP 2009-11-10 Tue

look for a couple more…

DONE find a paper for next week

DEADLINE: 2010-02-01 Mon
something good for this class

  • GP?
  • sensor network?

adaptive-mobile-agents.pdf

DONE read paper which should have received

DEADLINE: 2010-02-01 Mon

diffusion.ps from (here)

DONE email out this paper

experimental results

paper experiments

interleaved sin with static horizon

with

  • goal
    g 2x*sy*
    
  • reset packet
    r B:0 y:100 x:700 Y:0 X:14
    
  • start collecting with
    L schulte
    

first long run save here sin-interleaved.log

explorative experiments

malleable fitness landscape

malleable.first-run.log

malleable.first-run.later.log

1030y0961x/72//07/3072023+81*8x943x*x*-1*+*y//
set isosample 40
set xrange [-4:4]
set yrange [-2:2]
set zrange [-2:2]
splot sin(2*x)*y, (8 / ((x * (9 + ((4 - ((3 * x) * x)) * 1))) / y))

malleable.0.0.horizons

malleable.0.0.mean-fit-and-horiz

set yrange [0:200]
plot data using 1:2 title 'mean fitness', data using 1:3 title 'horizon'

data/malleable-mean-fit-and-horizon.png

  • holder
    12.790.98
    22.340.98
    12.220.98
    24.031.73
    27.401.73
    17.281.73
    17.761.73
    27.071.94
    32.841.94
    27.071.94
    31.631.95
    31.281.95
    31.281.95
    31.281.95
    30.841.97
    27.551.97
    18.611.97
    16.991.97
    11.932.64
    9.372.64
    28.382.64
    8.972.64
    21.062.81
    21.242.81
    20.102.81
    26.032.90
    27.182.90
    26.772.90
    34.932.90
    74.322.81
    27.472.81
    26.782.81
    28.822.81
    35.453.05
    36.763.05
    26.083.05
    30.393.05
    33.492.95
    31.932.95
    33.102.95
    31.932.96
    31.722.96
    38.922.96
    30.392.96
    31.473.04
    27.163.04
    27.673.04
    20.433.04
    21.003.42
    49.063.42
    20.353.42
    20.903.42
    25.273.92
    24.273.92
    23.813.92
    32.654.65
    46.724.65
    32.654.65
    41.584.65
    57.645.21
    57.255.21
    66.325.21
    804.415.21
    66.265.69
    66.435.69
    66.905.69
    137.505.69
    64.256.10
    66.626.10
    62.906.10
    78.696.46
    64.876.46
    76.976.46
    64.356.46
    63.866.61
    63.866.61
    75.876.61
    69.196.61
    76.216.45
    63.456.45
    63.456.45
    63.456.45
    65.556.42
    69.026.42
    63.446.42
    69.046.45
    63.496.45
    63.486.45
    63.466.45
    64.256.42
    63.476.42
    63.506.42
    77.586.42
    63.346.44
    64.396.44
    63.346.44
    64.296.44
    64.786.45
    89.716.45
    63.676.45
    83.036.36
    63.506.36
    65.596.36
    63.396.36
    63.446.06
    63.446.06
    63.706.06
    63.906.06
    64.455.84
    64.385.84
    64.375.84
    64.405.58
    62.455.58
    62.055.58
    61.665.58
    61.625.52
    61.315.52
    62.335.52
    61.315.52
    61.325.40
    64.265.40
    63.165.40
    61.325.40
    67.205.18
    60.785.18
    59.455.18
    58.445.11
    58.185.11
    58.185.11
    58.185.11
    58.954.95
    63.744.95
    58.174.95
    58.124.95
    58.794.90
    56.734.90
    54.654.90
    54.334.90
    65.014.99
    57.174.99
    54.924.99
    55.895.02
    58.195.02
    56.335.02
    56.335.02
    67.245.02
    56.685.02
    56.775.02
    56.245.02
    58.404.98
    55.664.98
    55.664.98
    55.664.98
    62.604.95
    69.164.95
    60.974.95
    55.554.89
    53.984.89
    53.984.89
    53.984.89
    54.024.99
    54.024.99
    59.794.99
    54.024.99
    56.285.27
    55.965.27
    55.965.27
    58.845.42
    80.585.42
    59.795.42
    58.795.42
    59.655.29
    59.465.29
    58.905.29
    58.905.29
    58.525.15
    67.005.15
    57.925.15
    57.925.15
    57.425.01
    56.215.01
    56.215.01
    56.564.88
    54.294.88
    53.774.88
    57.354.88
    54.584.67
    51.694.67
    52.004.67
    51.614.67
    114.254.59
    50.174.59
    49.354.59
    125.784.59
    49.264.58
    49.634.58
    56.574.58
    49.284.66
    49.254.66
    49.254.66
    49.254.66
    51.474.72
    51.474.72
    51.854.72
    53.724.72
    53.444.71
    52.964.71
    52.544.71
    52.404.71
    57.944.71
    52.194.71
    52.194.71
    52.194.69
    52.494.69
    52.394.69
    53.094.69
    52.004.76
    64.414.76
    52.004.76
    52.004.76
    52.764.68
    53.764.68
    52.734.68
    51.774.68
    57.484.80
    52.214.80
    55.324.80
    54.844.84
    54.844.84
    55.974.84
    57.094.84
    55.764.92
    56.624.92
    55.764.92
    55.764.92
    58.294.92
    57.194.92
    57.194.92
    58.664.92
    57.244.93
    69.554.93
    57.244.93
    68.424.90
    56.874.90
    56.874.90
    62.444.90
    56.894.93
    57.394.93
    56.894.93
    57.854.93
    57.224.91
    62.764.91
    57.054.91
    57.034.86
    57.134.92
    72.654.92
    59.214.92
    57.344.96
    57.344.96
    57.344.96
    58.294.96
    53.884.52
    47.724.52
    47.204.52
    47.204.52
    33.413.39
    26.203.39
    26.093.39
    25.324.20
    25.554.20
    25.714.20
    25.554.20
    40.384.54
    42.464.54
    44.394.54
    40.384.54
    48.524.53
    47.534.53
    47.534.53
    50.784.53
    46.114.38
    45.314.38
    44.704.38
    43.944.25
    41.434.25
    41.274.25
    42.674.25
    40.664.16
    39.184.16
    50.174.16
    39.184.16
    41.828.59
    40.538.59
    40.738.59
    97.088.59
    93.2610.00
    105.5210.00
    93.5010.00
    138.469.37
    96.209.37
    105.519.37
    100.319.37
    91.629.05
    86.489.05
    85.209.05
    95.149.05
    85.658.56
    85.158.56
    90.218.56
    93.498.16
    122.718.16
    90.418.16
    102.847.58
    102.717.58
    105.787.58
    102.237.58
    101.827.16
    94.037.16
    87.857.16
    88.227.16
    88.197.35
    88.457.35
    99.267.35
    90.897.54
    89.237.63
    86.697.63
    85.987.63
    85.278.44
    84.488.44
    84.858.44
    106.778.44
    82.159.42
    82.349.42
    93.699.42
    82.389.42
    95.389.58
    95.719.58
    96.309.58
    100.849.66
    101.369.66
    106.609.66
    101.019.66
    102.359.61
    99.509.61
    95.949.61
    94.979.61
    94.908.55
    95.838.55
    92.228.55
    89.258.55
    88.048.55
    86.958.55
    85.608.55
    85.318.48
    84.808.48
    90.228.48
    83.868.48
    83.388.56
    195.038.56
    88.498.56
    84.198.56
    84.948.46
    83.198.46
    82.988.46
    89.278.46
    101.848.45
    79.628.45
    79.628.45
    80.529.18
    82.209.18
    79.829.18
    82.379.18
    87.209.18
    86.279.18
    85.219.18
    84.819.18
    89.059.00
    81.519.00
    82.329.00
    81.548.91
    80.058.79
    78.918.79
    79.708.79
    167.868.07
    82.478.07
    81.048.07
    79.448.07
    100.717.39
    99.367.39
    92.037.39
    89.927.39
    88.947.24
    83.717.24
    77.217.24
    73.067.25
    74.567.25
    82.787.25
    81.337.25
    74.457.35
    73.797.35
    73.797.35
    74.457.35
    80.107.19
    74.987.19
    98.417.19
    74.287.19
    73.347.31
    73.537.31
    73.167.31
    77.507.33
    86.257.33
    78.187.33
    78.237.33
    81.477.41
    78.637.41
    94.537.41
    2144.077.41
    81.267.16
    74.277.16
    73.747.16
    73.487.16
    71.857.13
    80.497.13
    66.697.13
    69.198.21
    69.198.21
    70.298.21
    80.498.21
    150.936.63
    76.846.63
    73.656.63
    68.826.63
    69.337.13
    66.337.13
    65.307.13
    64.547.13
    65.737.70
    65.657.70
    67.027.70
    117.466.73
    75.546.73
    65.926.73
    74.286.73
    65.137.18
    64.457.18
    65.017.18
    64.267.18
    72.597.40
    68.557.40
    69.367.40
    84.697.04
    71.937.04
    63.297.04
    63.307.04
    64.436.73
    75.186.73
    83.956.73
    62.376.73
    65.766.65
    63.206.65
    58.516.65
    56.256.65
    55.896.72
    54.286.72
    53.606.72
    53.596.76
    53.036.76
    52.556.76
    52.506.76
    51.946.61
    48.416.61
    46.156.61
    45.066.61
    47.048.04
    1130.418.04
    45.998.04
    127.658.04
    111.807.58
    99.537.58
    91.657.58
    90.677.37
    84.817.37
    77.807.37
    75.767.37
    74.867.29
    73.757.29
    71.837.29
    72.137.29
    73.297.35
    71.497.35
    70.067.35
    70.577.35
    68.997.19
    65.537.19
    62.797.19
    65.897.34
    63.777.34
    63.817.34
    64.277.34
    72.247.09
    65.487.09
    60.977.09
    59.537.09
    60.577.17
    59.917.17
    60.747.17
    62.727.17
    61.487.13
    65.677.13
    61.427.13
    60.817.52
    61.527.52
    60.677.52
    129.637.52
    75.957.44
    73.597.44
    72.527.44
    87.967.44
    70.907.21
    65.347.21
    116.367.21
    67.196.96
    63.096.96
    61.806.96
    60.836.96
    69.547.26
    61.357.26
    142.737.26
    58.087.26
    63.267.15
    59.167.15
    57.367.15
    58.757.15
    63.0710.00
    59.3410.00
    59.9010.00
    183.7310.00
    148.6110.00
    143.1510.00
    137.8310.00
    133.309.91
    124.599.91
    109.079.91
    103.549.91
    99.729.87
    99.019.87
    174.339.87
    90.829.87
    88.489.78
    79.969.78
    75.099.78
    70.069.07
    70.589.07
    75.409.07
    71.989.07
    238.195.61
    79.655.61
    74.575.61
    112.315.61
    291.006.07
    63.326.07
    59.676.07
    55.666.07
    56.787.09
    56.787.09
    56.577.09
    106.706.83
    90.146.83
    87.556.83
    80.686.83
    78.827.08
    77.927.08
    72.547.08
    94.047.08
    68.977.33
    68.697.33
    68.947.33
    73.717.33
    74.038.47
    74.378.47
    74.378.47
    110.897.80
    93.727.80
    82.637.80
    79.287.80
    78.717.73
    76.157.73
    76.507.73
    77.017.73
    76.988.70
    76.258.70
    76.708.70
    103.408.37
    90.428.10
    82.308.10
    75.128.10
    84.768.20
    71.298.20
    76.038.20
    80.818.20
    69.317.69
    65.777.69
    63.197.69
    72.327.69
    66.177.56
    64.617.56
    62.257.56
    65.617.89
    70.627.89
    62.777.89
    61.467.89
    67.248.10
    68.248.10
    65.838.10
    66.258.10
    65.388.89
    65.498.89
    65.628.89
    65.548.89
    69.298.55
    63.668.55
    71.948.55
    62.088.12
    56.418.12
    58.668.12
    56.288.12
    65.127.92
    65.167.92
    63.907.92
    64.107.92
    89.186.80
    85.116.80
    79.016.80
    80.736.80
    83.228.10
    77.218.10
    81.308.10
    200.597.94
    106.107.94
    118.527.94
    81.747.94
    78.129.32
    78.609.32
    78.149.32
    76.659.32
    85.329.75
    85.129.75
    82.729.75
    90.709.75
    87.5910.00
    79.5810.00
    79.7910.00
    83.6810.00
    83.7310.00
    82.0510.00
    83.3110.00
    83.5810.00
    83.0010.00
    83.6810.00
    83.5110.00
    106.639.87
    83.829.87
    79.079.87
    76.3910.00
    75.1010.00
    88.5610.00
    80.2510.00
    84.1310.00
    84.3010.00
    90.0910.00
    83.9110.00
    83.5810.00
    83.5810.00
    88.7810.00
    85.4310.00
    83.3610.00
    83.5110.00
    195.5410.00
    82.9610.00
    83.7210.00
    82.0510.00
    84.2910.00
    83.9410.00
    83.6110.00
    82.0510.00
    82.0510.00
    83.6510.00
    82.0510.00
    82.0510.00
    82.0510.00
    86.8010.00
    83.5210.00
    83.5710.00
    82.0510.00
    84.0210.00
    84.1810.00
    84.3610.00
    82.589.85
    81.619.85
    80.569.85
    84.899.85
    78.389.75
    69.929.75
    70.219.75
    80.639.75
    73.7810.00
    67.4210.00
    67.3010.00
    95.4210.00
    112.3110.00
    90.4610.00
    88.7810.00
    90.079.89
    81.479.89
    76.469.89
    77.179.89
    72.0210.00
    74.0110.00
    73.5410.00
    85.9010.00
    84.6210.00
    83.0810.00
    90.8810.00
    85.529.99
    82.569.99
    86.109.99
    95.179.99
    83.4910.00
    95.3010.00
    83.1310.00
    86.8510.00
    80.229.87
    75.559.87
    72.269.87
    72.8010.00
    72.1710.00
    72.5410.00
    71.5110.00
    86.119.76
    159.739.76
    109.289.76
    85.359.76
    69.059.98
    75.669.98
    160.569.98
    71.039.98
    79.069.72
    75.609.72
    222.919.72
    72.3310.00
    72.0710.00
    72.8410.00
    72.0210.00
    83.6110.00
    84.6410.00
    83.0810.00
    85.0610.00
    84.1810.00
    85.6710.00
    84.7110.00
    568.8510.00
    79.969.85
    74.159.85
    70.569.85
    71.1710.00
    69.6310.00
    71.8310.00
    71.1210.00
    82.249.84
    77.369.84
    71.939.84
    69.349.84
    73.1910.00
    71.8610.00
    80.8810.00
    86.7910.00
    81.209.67
    76.639.67
    71.179.67
    70.599.71
    81.399.71
    81.999.71
    78.699.71
    78.339.88
    68.279.88
    66.529.88
    66.529.88
    78.009.27
    75.319.27
    67.789.27
    84.799.27
    59.979.45
    59.399.45
    58.489.45
    52.2310.00
    53.3810.00
    57.2710.00
    54.7410.00
    148.7910.00
    115.8710.00
    107.6410.00
    100.4410.00
    91.9510.00
    86.6410.00
    84.7010.00
    83.0810.00
    231.7310.00
    83.0810.00
    86.2410.00
    84.7510.00
    84.6910.00
    96.7410.00
    83.0810.00
    81.599.88
    75.419.88
    81.439.88
    71.059.88
    71.5010.00
    76.7210.00
    72.9710.00
    85.139.82
    78.729.82
    71.459.82
    71.109.82
    73.5510.00
    69.6510.00
    94.4510.00
    72.6110.00
    81.009.81
    77.359.81
    74.139.81
    69.439.81
    69.7110.00
    72.2310.00
    71.1510.00
    84.269.47
    79.589.47
    72.149.47
    77.449.47
    65.089.65
    61.339.65
    86.359.65
    59.189.65
    72.4210.00
    64.0710.00
    68.0710.00
    100.6010.00
    95.048.79
    90.808.79
    77.388.79
    71.988.89
    61.728.89
    56.998.89
    56.708.89
    56.859.26
    56.639.26
    56.859.26
    54.809.26
    65.829.55
    117.329.55
    65.969.55
    69.079.59
    59.649.59
    56.039.59
    54.849.59
    59.4710.00
    56.8210.00
    54.2810.00
    54.2010.00
    101.768.59
    100.708.59
    128.548.59
    86.158.59
    72.825.93
    65.295.93
    63.395.93
    55.806.21
    56.416.75
    56.886.75
    57.776.75
    91.056.66
    73.686.66
    66.246.66
    60.386.66
    60.777.33
    60.777.33
    60.757.33
    60.647.33
    100.727.20
    93.757.20
    146.017.20
    78.807.55
    68.437.55
    73.547.55
    65.257.55
    69.208.81
    69.208.81
    94.658.81
    69.138.81
    89.219.14
    83.589.14
    75.869.14
    70.019.14
    67.779.44
    62.379.44
    53.339.44
    54.7210.00
    53.1510.00
    53.1710.00
    55.6710.00
    192.749.36
    74.349.36
    60.469.36
    58.049.36
    51.7110.00
    53.6010.00
    53.8410.00
    104.3810.00
    89.519.23
    285.739.23
    295.779.23
    55.3810.00
    56.3810.00
    58.2210.00
    60.0810.00
    103.937.27
    101.327.27
    95.527.27
    90.817.27
    87.397.12
    99.427.12
    76.447.12
    106.287.12
    65.706.72
    58.546.72
    52.386.72
    51.127.41
    50.597.41
    51.317.41
    50.597.41
    79.137.17
    74.507.17
    69.107.17
    68.307.17
    73.637.85
    69.357.85
    68.867.85
    96.047.48
    141.057.48
    83.927.48
    200.917.48
    80.847.83
    79.527.83
    79.927.83
    78.267.83
    75.848.25
    67.868.25
    50.668.25
    47.208.25
    48.928.85
    57.718.85
    71.828.85
    75.589.55
    74.779.55
    74.799.55
    72.749.55
    count = 0
    table.map{|vars| count += 1; puts "|#{count} | #{vars[0]} | #{vars[1]} |" }
    

malleable easy task

overlapping 2D distributed fitness landscape

  • y * sin(2*x)
    • with |-| config
      with a
      xxx
       x 
      xxx
      

      configuration

      91+06*x3+y3/5598y+x8600yyy3/557/0+x56/x/*+x-**
      
      : ((6 * y) * ((6 + ((x - (((x + x) + x) + 2)) - ((8 - 0) / 9))) / 7))

      the next day

      positionrpnalg
      (0,0)"+0+91-/2+4y450++2822x9//x65*x+*/1//-x82x*/+/y*"(((8 - (2 / (((2 / (x / 9)) / (x * ((6 * 5) + x))) / 1))) / (x + (8 / (2 * x)))) * y)
      (1,1)"91+06*x3+y3/5598y+x8600yyy3/557/0+x56/x/*+x-**"((y / 3) * (5 * ((((5 / 7) + 0) + (x * ((5 / 6) / x))) - x)))
      (1,0)"9++6*x*+y3/559/0+y8+0*2yy3/557/0+x56/x/*+x-*"((y / 3) * (5 * ((((5 / 7) + 0) + (x * ((5 / 6) / x))) - x)))
      (1,-1)"09x860x*2y31870/077*/103+y//557/0+x56/x/*+x-**"((1 / ((0 + 3) / y)) * (5 * ((((5 / 7) + 0) + (x * ((5 / 6) / x))) - x)))
      (-1,1)"14/770y028x9/1x65*x-*/1//-x82x*/+//+/2*"((y / (0 + (2 / ((8 - ((x / 9) / ((1 / (x * ((6 * 5) - x))) / 1))) / (x + (8 / (2 * x))))))) * 2)
      (-1,0)"44x7x+y028x9/1x65*x-*/1//-x82x*/+//+/2*"((y / (0 + (2 / ((8 - ((x / 9) / ((1 / (x * ((6 * 5) - x))) / 1))) / (x + (8 / (2 * x))))))) * 2)
      (-1,-1)"4/x74-y028-y028x9/1x65*x-*/1//-x82x*/+//+/2*"((y / (0 + (2 / ((8 - ((x / 9) / ((1 / (x * ((6 * 5) - x))) / 1))) / (x + (8 / (2 * x))))))) * 2)
      set isosample 40
      set xrange [-2:2]
      set yrange [-2:2]
      set zrange [-2:2]
      f(x,y) =  ((x < -1) ? ((y / (0 + (2 / ((8 - ((x / 9) / ((1 / (x * ((6 * 5) - x))) / 1))) / (x + (8 / (2 * x))))))) * 2) : (x > 1) ? ((y / 3) * (5 * ((((5 / 7) + 0) + (x * ((5 / 6) / x))) - x))) : (((8 - (2 / (((2 / (x / 9)) / (x * ((6 * 5) + x))) / 1))) / (x + (8 / (2 * x)))) * y) )
      splot y*sin(2*x), f(x,y)
      
    • with line config
      1x*y71x*x60417+x*1y8-yx35/4x-3*2--2*//
      
      set isosample 40
      set xrange [-3:4.33]
      set yrange [-1:1]
      set zrange [-2:2]
      f(x,y) = (((x > 3) && (x < 4.33)) ? (y / (x / (((3 / 5) - (((6 - x) * 3) - 8)) * 2))) : {0,1})
      g(x,y) = (((x > 2) && (x < 3.33)) ? ((2 - ((9 / 6) / (4 - x))) / (2 / ((((y / ((x - 2) * ((2 / 9) - 1))) - y) / 6) - y))) : {0,1})
      h(x,y) = (((x > 1) && (x < 2.33)) ? ((((8 - (5 * x)) - (2 / 8)) * y) / 3) : {0,1})
      i(x,y) = (((x > 0) && (x < 1.33)) ? ((((x * 4) + 3) / 7) / ((x / y) / x)) : {0,1})
      j(x,y) = (((x > -1) && (x < 0.33)) ? ((((x + 3) - 7) + 4) * y) : {0,1})
      k(x,y) = (((x > -2) && (x < -0.67)) ? ((y / 1) / ((x - 7) / ((((3 + x) + x) / 1) * 7))) : {0,1})
      l(x,y) = (((x > -3) && (x < -1.67)) ? (y * ((4 + x) / 2)) : {0,1})
      splot f(x,y), g(x,y), h(x,y), i(x,y), j(x,y), k(x,y), l(x,y)
      

      some pretty plots data/sine-line.1.png

      data/sine-line.2.png

      then some time after the run had started… overlapping-sin2x-y-in-line.log

      set isosample 40
      set xrange [-3:4.33]
      set yrange [-1:1]
      set zrange [-2:2]
      f(x,y) = (((x > 3) && (x < 4.33)) ? (y / (x / (((3 / 5) - (((4 - x) * 3) - 2)) * 2))) : {0,1})
      g(x,y) = (((x > 2) && (x < 3.33)) ? ((2 - ((9 / 6) / (4 - x))) / (2 / ((((y / ((x - 2) / ((2 / 8) - 1))) - y) / 4) - y))) : {0,1})
      h(x,y) = (((x > 1) && (x < 2.33)) ? ((((8 - (5 * x)) - (2 / 8)) * y) / 3) : {0,1})
      i(x,y) = (((x > 0) && (x < 1.33)) ? ((3 + 2) / ((((5 * x) / (5 / ((5 - 1) + (0 + (7 / (x * 5)))))) / y) / x)) : {0,1})
      j(x,y) = (((x > -1) && (x < 0.33)) ? ((((8 + (1 + x)) - 7) * x) * y) : {0,1})
      k(x,y) = (((x > -2) && (x < -0.67)) ? (7 / ((7 - x) / ((y / 1) * ((x - 3) - (((x + x) + x) / 1))))) : {0,1})
      l(x,y) = (((x > -3) && (x < -1.67)) ? (y * ((6 + x) / 5)) : {0,1})
      splot f(x,y), g(x,y), h(x,y), i(x,y), j(x,y), k(x,y), l(x,y)
      

      data/sine-line.old.1.png

      data/sine-line.old.2.png

    • with line config – no overlap in plots
      1x*y71x*x60417+x*1y8-yx35/4x-3*2--2*//
      
      set isosample 40
      set xrange [-3:4]
      set yrange [-1:1]
      set zrange [-2:2]
      f(x,y) = ((x > 3) ? (y / (x / (((3 / 5) - (((6 - x) * 3) - 8)) * 2))) : {0,1})
      g(x,y) = (((x > 2) && (x < 3)) ? ((2 - ((9 / 6) / (4 - x))) / (2 / ((((y / ((x - 2) * ((2 / 9) - 1))) - y) / 6) - y))) : {0,1})
      h(x,y) = (((x > 1) && (x < 2)) ? ((((8 - (5 * x)) - (2 / 8)) * y) / 3) : {0,1})
      i(x,y) = (((x > 0) && (x < 1)) ? ((((x * 4) + 3) / 7) / ((x / y) / x)) : {0,1})
      j(x,y) = (((x > -1) && (x < 0)) ? ((((x + 3) - 7) + 4) * y) : {0,1})
      k(x,y) = (((x > -2) && (x < -1)) ? ((y / 1) / ((x - 7) / ((((3 + x) + x) / 1) * 7))) : {0,1})
      l(x,y) = (((x > -3) && (x < -2)) ? (y * ((4 + x) / 2)) : {0,1})
      splot f(x,y), g(x,y), h(x,y), i(x,y), j(x,y), k(x,y), l(x,y)
      

      some pretty plots data/sine-line.png

      data/sine-line.2.png

      data/sine-line.3.png

      then some time after the run had started… overlapping-sin2x-y-in-line.log

      set isosample 40
      set xrange [-3:4]
      set yrange [-1:1]
      set zrange [-2:2]
      f(x,y) = (((x > 3) && (x < 4)) ? (y / (x / (((3 / 5) - (((4 - x) * 3) - 2)) * 2))) : {0,1})
      g(x,y) = (((x > 2) && (x < 3)) ? ((2 - ((9 / 6) / (4 - x))) / (2 / ((((y / ((x - 2) / ((2 / 8) - 1))) - y) / 4) - y))) : {0,1})
      h(x,y) = (((x > 1) && (x < 2)) ? ((((8 - (5 * x)) - (2 / 8)) * y) / 3) : {0,1})
      i(x,y) = (((x > 0) && (x < 1)) ? ((3 + 2) / ((((5 * x) / (5 / ((5 - 1) + (0 + (7 / (x * 5)))))) / y) / x)) : {0,1})
      j(x,y) = (((x > -1) && (x < 0)) ? ((((8 + (1 + x)) - 7) * x) * y) : {0,1})
      k(x,y) = (((x > -2) && (x < -1)) ? (7 / ((7 - x) / ((y / 1) * ((x - 3) - (((x + x) + x) / 1))))) : {0,1})
      l(x,y) = (((x > -3) && (x < -2)) ? (y * ((6 + x) / 5)) : {0,1})
      splot f(x,y), g(x,y), h(x,y), i(x,y), j(x,y), k(x,y), l(x,y)
      

      data/sine-line.old.1.png

      data/sine-line.old.2.png

2d distributed fitness landscape

  • with |-| config
    with a
    xxx
     x 
    xxx
    

    configuration

    • x+y
      pretty quickly got
      *22+725/2615517yy67/x*+5+9/**/xy-7138*/*y1yx+*
      

      which is a perfect match

    • x^2 + y^2
      getting the following individual as the best against the goal of x^2 *
      positionrpnalg
      (0,0)"903+*4/22xx*923y8*9249yy*2xx2/**+"((y * y) + (2 * (x * (x / 2))))
      (1,1)"99/y4060x048*94y2yy*2xx2/**+"((y * y) + (2 * (x * (x / 2))))
      (1,0)"99653x09484*094y24*0x048*94y2yy*2xx2/**+"((y * y) + (2 * (x * (x / 2))))
      (1,-1)"9//y2+x0+1-8**9y0yy*2xx2/**+"((y * y) + (2 * (x * (x / 2))))
      (-1,1)"4/++*x432+7*9+348*91y2yy*2xx2/**+"((y * y) + (2 * (x * (x / 2))))
      (-1,0)"9/++*4-325x*0x348*94y2yy*2xx2/**+"((y * y) + (2 * (x * (x / 2))))
      (-1,-1)"91++*46325x*0x348*94y2yy*2xx2/**+"((y * y) + (2 * (x * (x / 2))))
      set isosample 40
      set xrange [-2:2]
      set yrange [-2:2]
      set zrange [-8:8]
      splot (x**2)+(y**2), ((y * y) + (2 * (x * (x / 2))))
      
    • y * sin(2*x)
      detailed log saved in 2d-y-sin-2x.log

      getting the following individual after ~20 minutes

      positionrpnalg
      (0,0)"9920826+2379+2+5*8y5x+x+x+x+/83+*x*"(((y / ((((5 + x) + x) + x) + x)) * (8 + 3)) * x)…
      (1,1)"yy4x-806357180y653-523x-/++x45+/x*6*5*-5y//"((((5 - 3) + (5 + (2 / (3 - x)))) - ((((x / (4 + 5)) * x) * 6) * 5)) / (5 / y))…
      (1,0)"x350x*532523x+/++x55+/x*6*5*-5y//"(((2 + (5 + (2 / (3 + x)))) - ((((x / (5 + 5)) * x) * 6) * 5)) / (5 / y))…
      (1,-1)"x68–19+357150x*532523x+/++x55+/x*6*5*-5y//"(((2 + (5 + (2 / (3 + x)))) - ((((x / (5 + 5)) * x) * 6) * 5)) / (5 / y))…
      (-1,1)"yxxy587-2xx3/x58782xx3/6+5///5-/y*"((8 / ((2 / (x / (((x / 3) + 6) / 5))) - 5)) * y)…
      (-1,0)"+38*2y5258+7–9-8306-4382x30/6+5///5-/y*"((8 / ((2 / (x / (((3 / 0) + 6) / 5))) - 5)) * y)…
      (-1,-1)"-518919427661-3/++x25/282xy3/6+5///5-/y*"((8 / ((2 / (x / (((y / 3) + 6) / 5))) - 5)) * y)…

      now after ~80 minutes

      positionrpnalg
      (0,0)"588y0+/302y-5*457+117y5x*1+1+3+/48+*x*"(((y / ((((5 * x) + 1) + 1) + 3)) * (4 + 8)) * x)
      (1,1)"477-*1x/x/665/2/-/7+2+7-3x+/7+657+/x*6*x*-5y//"((((((((((1 / x) / x) / (6 - ((6 / 5) / 2))) + 7) + 2) - 7) / (3 + x)) + 7) - ((((6 / (5 + 7)) * x) * 6) * x)) / (5 / y))
      (1,0)"476-*1x/x/665/2/-/7+2+7-3x+/7+657+/x*6*x*-5y//"((((((((((1 / x) / x) / (6 - ((6 / 5) / 2))) + 7) + 2) - 7) / (3 + x)) + 7) - ((((6 / (5 + 7)) * x) * 6) * x)) / (5 / y))
      (1,-1)"497-*1x/x/665/2/-/7+2+7-3x+/7+657+/x*6*x*-5y//"((((((((((1 / x) / x) / (6 - ((6 / 5) / 2))) + 7) + 2) - 7) / (3 + x)) + 7) - ((((6 / (5 + 7)) * x) * 6) * x)) / (5 / y))
      (-1,1)"18x*/01089/3281-96+x73x*+2x62+0+7///2-/y*"(((7 + (3 * x)) / ((2 / (x / (((6 + 2) + 0) / 7))) - 2)) * y)
      (-1,0)"19x*/21089/3291x+69x73x*+2x62+0+7///2-/y*"(((7 + (3 * x)) / ((2 / (x / (((6 + 2) + 0) / 7))) - 2)) * y)
      (-1,-1)"19x*/21089/32995+69x73x*+2x62+0+7///2-/y*"(((7 + (3 * x)) / ((2 / (x / (((6 + 2) + 0) / 7))) - 2)) * y)
      set isosample 40
      set xrange [-2:2]
      set yrange [-2:2]
      set zrange [-2:2]
      splot y*sin(2*x), ((((5 - 3) + (5 + (2 / (3 - x)))) - ((((x / (4 + 5)) * x) * 6) * 5)) / (5 / y))
      
  • with line config
    after letting it run in a line for an hour or so
    1-1x98+46y3/307889+//3y87y*0-9+69x2+y+4/xyy*+*
    
    : ((((x + 2) + y) / 4) * (x + (y * y)))

tools

rpn-to-alg

mainly for clojure practice, lets re-write the above

(def binary-operators '(\+ \- \* \/))
(def unary-operators '(\s))
(defn rpn-to-alg [chars stack]
  (if (> (.size chars) 0)
    (let [el (first chars)]
      (if (some #{el} binary-operators)
        (rpn-to-alg (rest chars)
                    (cons
                     (apply str "(" (or (second stack) 1) " " el " " (or (first stack) 1) ")")
                     (rest (rest stack))))
        (if (some #{el} unary-operators)
          (rpn-to-alg (rest chars)
                      (cons
                       (apply str "(" el " " (or (first stack) 1) ")")
                       (rest (rest stack))))
          (rpn-to-alg (rest chars) (cons el stack)))))
    (first stack)))
(println (apply str (rpn-to-alg (seq alg) '())))