[Push] Advice on Fitness

Lee Spector lspector at hampshire.edu
Thu May 6 18:24:19 EDT 2010


What are you using now? 

In my clojure version of the odd problem I use the code below as the error function, which in English says try inputs 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and for each push the input on the integer stack and also make it available via an "in" instruction (which pushes it on the integer stack -- I do this via an auxiliary stack but that's just an implementation detail), and then run the program and look at the top item of the boolean stack at the end. If there's no item on top of the boolean stack the error for that case is a penalty of 1000. If there is an item then the error for that case is 0 if it's right for the input and 1 if it's wrong. The total error ("fitness," for which lower is better) for the individual is the sum of the errors for the 10 cases. I run this with all of the implemented push instructions available, the "in" instruction, and random positive integers less than 100.

 -Lee


	 (fn [program]
	   (doall
	    (for [input (range 10)]
	      (let [state (run-push program
				    (push-item input :auxiliary
					       (push-item input :integer
							  (make-push-state))))
		    top-bool (top-item :boolean state)]
		(if (not (= top-bool :no-stack-item))
		  (if (= top-bool (odd? input)) 0 1)
		  1000)))))


On May 6, 2010, at 5:27 PM, Rud Merriam wrote:

> I have my PushX running with a crossover operation and trying to solve the ODD problem, i.e. Boolean result if an integer is odd or even.
> 
> I'm not having any success so I'm guessing my fitness test is not crafted properly. What would everyone suggest? 
>   
>  - 73 - 
> Rud Merriam K5RUD
> http://mysticlakesoftware.com/
> 
> _______________________________________________
> Push mailing list
> Push at lists.hampshire.edu
> https://lists.hampshire.edu/mailman/listinfo/push

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspector at hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/



More information about the Push mailing list