Venice 0.751beta

nz.org.venice.analyser.ga
Class GAIndividual

java.lang.Object
  extended bynz.org.venice.analyser.ga.GAIndividual

public class GAIndividual
extends java.lang.Object

A trading individual evolved by the GA. The Individual contains a set of parameters for the buy rule and the sell rule.


Constructor Summary
GAIndividual(java.util.Random random, GAIndividual lowest, GAIndividual highest)
          Randomly generate an individual using two individuals as highest and lowest limits for the parameters.
GAIndividual(java.util.Random random, GAIndividual mother, GAIndividual father, GAIndividual lowest, GAIndividual highest)
          Create a new individual by "breeding" or combining the two parent individuals.
GAIndividual(java.lang.String[] parameters, double[] values, int[] types)
          Create a new individual with the given parameters.
 
Method Summary
 Portfolio getPortfolio()
          Get the portfolio according to individual.
 Money getValue()
          Get the final value of the individual after paper trading.
 java.lang.String parameter(int index)
          Get the index parameter.
 void setPortfolio(Portfolio portfolio)
          Set the portfolio according to individual.
static void setRandomPercentage(int randomPercentage)
          Set the random mutation constants.
 void setValue(Money value)
          Set the final value of the individual after paper trading.
 int size()
          Get the number of parameters for this individual.
 int type(int index)
          Get the index type.
 double value(int index)
          Get the index value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GAIndividual

public GAIndividual(java.lang.String[] parameters,
                    double[] values,
                    int[] types)
Create a new individual with the given parameters.

Parameters:
parameters - the name of parameters
values - the values of parameters
types - the types of parameters (integer or float)

GAIndividual

public GAIndividual(java.util.Random random,
                    GAIndividual lowest,
                    GAIndividual highest)
Randomly generate an individual using two individuals as highest and lowest limits for the parameters.

Parameters:
lowest - lowest individual
highest - highest individual

GAIndividual

public GAIndividual(java.util.Random random,
                    GAIndividual mother,
                    GAIndividual father,
                    GAIndividual lowest,
                    GAIndividual highest)
Create a new individual by "breeding" or combining the two parent individuals.

Parameters:
random - the random number generator
father - one parent individual
mother - another parent individual
Method Detail

getValue

public Money getValue()
Get the final value of the individual after paper trading.

Returns:
the final value

setValue

public void setValue(Money value)
Set the final value of the individual after paper trading.

Parameters:
value - the final value

getPortfolio

public Portfolio getPortfolio()
Get the portfolio according to individual.

Returns:
the portfolio

setPortfolio

public void setPortfolio(Portfolio portfolio)
Set the portfolio according to individual.

Parameters:
portfolio - the portfolio

size

public int size()
Get the number of parameters for this individual.

Returns:
the number of parameter

parameter

public java.lang.String parameter(int index)
Get the index parameter.

Returns:
the string representing the parameter in the rule.

value

public double value(int index)
Get the index value.

Returns:
the double representing the value of the parameter in the rule.

type

public int type(int index)
Get the index type.

Returns:
the type of the parameter in the rule.

setRandomPercentage

public static void setRandomPercentage(int randomPercentage)
Set the random mutation constants.

Parameters:
randomPercentage - the randomness percentage used in GA algorithm

Venice 0.751beta