Paul Grobstein, Bryn
Mawr College Department of Biology
Clare Congdon, Bryn Mawr
College Computer Science Program
mkdir GPP cp ~ccongdon/Public/GPP/* GPP
Then, cd to your new GPP directory, and start up Lisp:
cd GPP clispFirst, load the basic GPP program:
(load "loadfile")This includes the exclusive-or task, which you can run immediately:
(run-ga)When this is done (it should take just a few minutes), two new files will be created, GA-individuals, and GA-output. Look at the first one to see what the best solution to the problem was at the end of each generation. If you want some help from Lisp in figuring out what each of these expressions does, try something like the following:
After 12 generations, my GP found the solution (AND (NOT (AND Y X)) (OR X Y)) to the XOR problem. I can set the values for X and Y and see what this expression evaluates to, or what parts of this evaluates to: (setf x T) (setf y T) (and (not (and y x)) (or x y)) --> NIL (x and y are both T) (setf x NIL) (and (not (and y x)) (or x y)) --> T (x is NIL and y is T) (setf y NIL) (and (not (and y x)) (or x y)) --> NIL (x and y are both NIL) (setf x T) (and (not (and y x)) (or x y)) --> T (x is T and y is NIL) I could also define a function to more quickly evaluate this: (defun test (x y) (and (not (and y x)) (or x y)) ) NOTE: Line breaks, indentation, and capitalization do not matter, but the parentheses are critical. Then, to test the function, I can type: (test T T) --> NIL (test NIL T) --> T (test NIL NIL) --> NIL (test T NIL) --> TWhat you can experiment with
To do this, find the line that begins with (setf *functions* ...), and edit the list. Be sure to keep the parentheses paired! (And don't edit the line that begins with a semicolon, which is commented out.)
Then, you have to recompile and reload the code:
(load "load-xor")
Then, you can run again:
(run-ga)
Caveat: if you find your Lisp program crashing after you've changed the primitives, you need to add extra terminal symbols. See the comments in the program about fixing this.
(load "load-inhibit1")You can then run this (run-ga), look at the solutions, edit the set of primitive functions, reload, rerun, etc.
You will probably need to reset the parameters to do more generations or to use a larger population size in order to find a solution. Remember that the file must be reloaded to have an effect.
(load "load-inhibit2")You can then run this (run-ga), look at the solutions, edit the set of primitive functions, reload, rerun, etc.
You will probably need to reset the parameters to do more generations or to use a larger population size in order to find a solution. Remember that the file must be reloaded to have an effect.
Note that each time you run the GPP, your GA-individuals file will get overwritten. If you want to save one, give it another name. For example, at the Unix prompt:
mv GA-individuals GA-xor
Maintained by: