genetic
Class Genetic
java.lang.Object
|
+--genetic.Genetic
- public class Genetic
- extends java.lang.Object
Genetic Algorithm adapted by Murat Yildizoglu ([email protected]).
This algorithm is used by the class GenFirm developped by
Murat Yildizoglu. It is adapted from the SGA class developped by Stephen J. Hartley
(SGA is Available by anonymous ftp from ftp.aic.nrl.navy.mil in directory
/pub/galist/src/ga. )
The main difference with SGA are the organization as a package and the elimination
of Application part of the code in order to let GenFirm drive the algorithm.
(C) Murat Yildizoglu, 2000-2001
Universite Bordeaux IV University Montesquieu.
Bordeaux France.
Permission to use, copy, modify, and distribute this
software and its documentation for NON-COMMERCIAL purposes
and without fee is hereby granted provided that this
copyright notice appears in all copies.
Last change: MY 17 Dec 98
- Version:
- 1.0 17 Dec 1998
- Author:
- Murat Yildizoglu (mailto:[email protected])
* *************** Class: Genetic ************************
Contains the Genetic Algorithm use by GenFirm
Implements the methods for selection, crossover and mutation.
Randomly initialises the population.
Initialisation :
Genetic(Number_of_Chromosomes, Chromosome_Length, Crossover_type,
Elitism, Crossover_Rate, Mutation_Rate);
************************************************************
|
Constructor Summary |
Genetic(int pop0,
int g0,
int xover0,
boolean elit0,
double xoverrate0,
double mutatrate0)
|
|
Method Summary |
void |
apply_elitism()
Uses elitism or not conditioned by the do_elitism option
chosen in the algorithm (cf. the constructor Genetic). |
void |
crossover()
|
int |
Decode(int chr)
|
double |
getFitness(int chr)
|
void |
mutate()
|
void |
newGeneration()
newGeneration(): Generates new generation through selection, crossover
and mutation. |
void |
selection()
Selection: Creates new population through selection and tries to
correct eventual degenerate Fitness point |
void |
SetFitness(int chr,
double reward)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Genetic
public Genetic(int pop0,
int g0,
int xover0,
boolean elit0,
double xoverrate0,
double mutatrate0)
newGeneration
public void newGeneration()
- newGeneration(): Generates new generation through selection, crossover
and mutation. Allows external application to generate new generations
on demand
Decode
public int Decode(int chr)
getFitness
public double getFitness(int chr)
SetFitness
public void SetFitness(int chr,
double reward)
selection
public void selection()
- Selection: Creates new population through selection and tries to
correct eventual degenerate Fitness point
crossover
public void crossover()
mutate
public void mutate()
apply_elitism
public void apply_elitism()
- Uses elitism or not conditioned by the do_elitism option
chosen in the algorithm (cf. the constructor Genetic).