com.groovyj.jgprog
Class MultiplexerWorld
java.lang.Object
|
+--com.groovyj.jgprog.World
|
+--com.groovyj.jgprog.MultiplexerWorld
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- MultiplexerADFWorld
- public class MultiplexerWorld
- extends World
The 11-multiplexer problem from Koza[1992], to find a formula to choose
one of eight boolean inputs based on the values of three other boolean inputs.
Uses a population size of 4000 with greedy overselection, and runs for 50 generations.
Note: This is where I found the need to optimize fitness calculations. By running this
program under the Java profiler (i.e. java -Xprof) I was able to determine where a majority
of the run time was being taken up. Originally the accesses to
Variable
were the most time-consuming,
so I optimized Variable. Now the majority of time is taken by the code of
computeRawFitness
, which I can't seem to get down any further.
Copyright (c) 2000 Robert Baruch. This code is released under
the GNU General Public License (GPL).
- Version:
- $Id: MultiplexerWorld.java,v 1.3 2000/10/12 15:22:55 groovyjava Exp $
- Author:
- Robert Baruch (jgprog@sourceforge.net)
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MultiplexerWorld
public MultiplexerWorld()
throws java.io.IOException
create
public void create()
computeFitness
public float computeFitness(Individual ind)
- Description copied from class:
World
- Computes the adjusted fitness of the given individual. The subclass must provide
an implementation of this method.
- Overrides:
computeFitness
in class World
- Following copied from class:
com.groovyj.jgprog.World
- Parameters:
individual
- the Individual to evaulate- Returns:
- the adjusted fitness, where bigger numbers are better. Does not necessarily
have to have a maximum value.
computeRawFitness
public float computeRawFitness(Individual ind)
run
public void run(int numGenerations)
main
public static void main(java.lang.String[] args)
throws java.lang.Exception