Class weightvector

java.lang.Object
  |
  +--weightvector

public class weightvector
extends java.lang.Object

this is a data-holding object that mainly just contains numbers that are used by the evaluation function. You could reuse this class for solving other problems with genetic algorithms. Note that the static members of this class determine what the weight vectors look like, so you would have to edit this part and recompile.


Constructor Summary
weightvector()
          create a new weigth vector filled with random numbers.
weightvector(java.lang.String s)
          create a new weight vector from the given string.
weightvector(weightvector w)
          make a copy of the given vector with small changes.
weightvector(weightvector[] pop)
          creates a new vector with the average of the given population.
 
Method Summary
 weightvector[] crossover(weightvector w)
          crosses this weight vector with the given weight vector.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

weightvector

public weightvector()
create a new weigth vector filled with random numbers.

weightvector

public weightvector(weightvector w)
make a copy of the given vector with small changes.

weightvector

public weightvector(weightvector[] pop)
creates a new vector with the average of the given population.

weightvector

public weightvector(java.lang.String s)
create a new weight vector from the given string. This constructor is compatible with the toString() method.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

crossover

public weightvector[] crossover(weightvector w)
crosses this weight vector with the given weight vector. It returns an array with two new weight vectors, that are random mixtures of the two parents.