Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.able.examples.genetic
Class TstGeneticFunction2a

    java.lang.Object
      com.ibm.able.beans.AbleGeneticObject
          com.ibm.able.examples.genetic.TstGeneticFunction2a

All Implemented Interfaces:
  java.io.Serializable

public class TstGeneticFunction2a
extends AbleGeneticObject

This class implements the F6 function described in the first chapter of The Handbook of Genetic Algorithms (Davis) Is used a hybrid (numeric) chromosome representation

See Also:
  Serialized Form

Field Summary
`static double` | `factor`
`protected static long` | `serialVersionUID` Serialized version identifier in form YYYYMMDDVerRelModxx

Fields inherited from class com.ibm.able.beans.AbleGeneticObject
`chromosome, chromosomeLength, chromosomeType, crossoverRate, evaluationAgent, fitness, fitnessComputed, member, mutationRate, normalizedFitness, searchAgent, vocabulary`

Constructor Summary
`TstGeneticFunction2a()`

Method Summary
`java.lang.Object[]` | `average(java.lang.Object[] parents)` Given 2 parent chromosomes Average their values , creating 2 children chromosomes
`double` | `computeFitness()` just add up the number of ones in the chromosome
`protected double` | `f6(double x, double y)`
`double` | `getFitness()` return the fitness value for this member Note: use computeFitness() to do the computation
`java.util.Hashtable` | `getOperatorFitness()` Return a hashtable of operator names (keys) and fitness values (Doubles) fitness values must sum to 100 Note: this hashtable may be extended to using operator fitness objects vs fixed values so that we can adapt the operators selection during the search process
`java.lang.Object` | `getRandomChromosome()` generate a random chromosome for this genetic object
`double[]` | `mutateChromosome(double[] chromosome)` Mutate a single chromosome.
`java.lang.Object[]` | `onePointCrossoverAndMutate(java.lang.Object[] parents)` Given 2 parent chromosomes Do a single point crossover (or not), creating 2 children chromosomes And mutate bits at the specified rate
`void` | `registerOperators(AbleAgent agent)` Register any unique or overridden operators (user-defined functions) with the SearchAgent.
`java.lang.String` | `toString()` return a string formatted for display default is the chromosome string and fitness if chromosome is not a string, then just fitness is returned Subclasses should override if necessary

Methods inherited from class com.ibm.able.beans.AbleGeneticObject
`binaryToInteger, generateRandomChromosome, getBean, getChromosome, getChromosomeLength, getChromosomeType, getCrossoverRate, getMutationRate, getNormalizedFitness, getVocabulary, initBean, initEvaluationAgent, mutate, mutateChromosome, onePointCrossover, removeBean, setChromosome, setCrossoverRate, setEvaluationAgent, setMutationRate, setNormalizedFitness, twoPointCrossover, uniformCrossover`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### serialVersionUID

    protected static final long serialVersionUID

  Serialized version identifier in form YYYYMMDDVerRelModxx

  See Also:
    Constant Field Values

### factor

    public static final double factor

See Also:
  Constant Field Values

Constructor Detail

### TstGeneticFunction2a

    public TstGeneticFunction2a()

Method Detail

### getFitness

    public double getFitness()

  Description copied from class: `AbleGeneticObject`
  return the fitness value for this member Note: use computeFitness() to do the computation

  Overrides:
    `getFitness` in class `AbleGeneticObject`

### getRandomChromosome

    public java.lang.Object getRandomChromosome()

  generate a random chromosome for this genetic object

  Overrides:
    `getRandomChromosome` in class `AbleGeneticObject`

### computeFitness

    public double computeFitness()

  just add up the number of ones in the chromosome

  Overrides:
    `computeFitness` in class `AbleGeneticObject`
  Returns:
    the fitness value for this population member

### f6

    protected double f6(double x,
                        double y)

### mutateChromosome

    public double[] mutateChromosome(double[] chromosome)

  Mutate a single chromosome. Note: this operator does a bitwise test against the mutationRate and then rolls the dice to select a delta to the current value

  Parameters:
    `chromosome` - The original chromosome array.
  Returns:
    the (potentially) mutated chromosome array.

### onePointCrossoverAndMutate

    public java.lang.Object[] onePointCrossoverAndMutate(java.lang.Object[] parents)

  Given 2 parent chromosomes Do a single point crossover (or not), creating 2 children chromosomes And mutate bits at the specified rate

  Overrides:
    `onePointCrossoverAndMutate` in class `AbleGeneticObject`

### average

    public java.lang.Object[] average(java.lang.Object[] parents)

  Given 2 parent chromosomes Average their values , creating 2 children chromosomes

### getOperatorFitness

    public java.util.Hashtable getOperatorFitness()
                                           throws AbleException

  Return a hashtable of operator names (keys) and fitness values (Doubles) fitness values must sum to 100 Note: this hashtable may be extended to using operator fitness objects vs fixed values so that we can adapt the operators selection during the search process

  Overrides:
    `getOperatorFitness` in class `AbleGeneticObject`
  Returns:
    the hashtable with operator fitness values
  Throws:
    `AbleException`

### registerOperators

    public void registerOperators(AbleAgent agent)

  Register any unique or overridden operators (user-defined functions) with the SearchAgent.

  Overrides:
    `registerOperators` in class `AbleGeneticObject`
  Parameters:
    `agent` - The search agent.

### toString

    public java.lang.String toString()

  return a string formatted for display default is the chromosome string and fitness if chromosome is not a string, then just fitness is returned Subclasses should override if necessary

  Overrides:
    `toString` in class `AbleGeneticObject`
  Returns:
    a string formatted for display purposes

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005