|
JAGA Homepage | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jaga.individualRepresentation.greycodedNumbers.NDecimalsIndividualSimpleFactory
TODO: Complete these comments.
Project: JAGA - Java API for Genetic Algorithms.
Company: University College London and JAGA.Org (http://www.jaga.org).
Copyright: (c) 2004 by G. Paperin.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, ONLY if you include a note of the original
author(s) in any redistributed/modified copy.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
or see http://www.gnu.org/licenses/gpl.html
| Field Summary | |
|---|---|
private RangeConstraint[] |
constraints
|
private double |
decimalScale
|
private int |
individualSize
|
private int |
precision
|
| Constructor Summary | |
|---|---|
NDecimalsIndividualSimpleFactory()
|
|
NDecimalsIndividualSimpleFactory(int varsPerIndividual,
int decPrecision,
int representationLen)
|
|
| Method Summary | |
|---|---|
Individual |
createDefaultIndividual(GAParameterSet params)
Creates a new default individual. |
Individual |
createRandomIndividual(GAParameterSet params)
Creates a random individual according to this factory's current internal settings and expariment paramanters. |
Individual |
createSpecificIndividual(BitString initVal)
|
Individual |
createSpecificIndividual(double[] initVal)
|
Individual |
createSpecificIndividual(NDecimalsIndividual initVal)
|
Individual |
createSpecificIndividual(java.lang.Object init,
GAParameterSet params)
Creates a new individual and initialises it to the specified value(s). |
private double[] |
getAllowedRange(int varInd)
|
RangeConstraint |
getConstraint(int variableIndex)
Gets the constraint for individuals' variable with specified index. |
int |
getDecimalScale()
|
int |
getIndividualSize()
|
int |
getPrecision()
|
void |
setConstraint(int variableIndex,
RangeConstraint constraint)
Sets the constraints for individuals' variable at the specified index. |
void |
setDecimalScale(int val)
|
void |
setIndividualSize(int size)
|
void |
setPrecision(int val)
|
boolean |
valid(NDecimalsIndividual indiv)
Checks if the values of the specified individual are in the ranges specified by constraints of this factory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int individualSize
private double decimalScale
private int precision
private RangeConstraint[] constraints
| Constructor Detail |
|---|
public NDecimalsIndividualSimpleFactory()
public NDecimalsIndividualSimpleFactory(int varsPerIndividual,
int decPrecision,
int representationLen)
| Method Detail |
|---|
public int getDecimalScale()
public void setDecimalScale(int val)
public int getIndividualSize()
public void setIndividualSize(int size)
public RangeConstraint getConstraint(int variableIndex)
variableIndex - the index of the variable inside the individuals to
which the constraint applies.
public void setConstraint(int variableIndex,
RangeConstraint constraint)
variableIndex - index of the variable to which the consteraint applies.constraint - the constraint.public int getPrecision()
public void setPrecision(int val)
public boolean valid(NDecimalsIndividual indiv)
indiv - some individual
true if all values encoded by this individual are inside the
ranges specified by the constrains applicable to this factory;
false otherwise.public Individual createDefaultIndividual(GAParameterSet params)
IndividualsFactory
createDefaultIndividual in interface IndividualsFactoryparams - Experiment parameters.
public Individual createRandomIndividual(GAParameterSet params)
IndividualsFactory
createRandomIndividual in interface IndividualsFactoryparams - Experiment parameters.
public Individual createSpecificIndividual(java.lang.Object init,
GAParameterSet params)
IndividualsFactoryinit can hold any value(s) which this factory
knows to interprete.Individual-objects of the same type as produced by the
factory. If such an Individual-object is passed as the
init-value, a deep copy of the individual should be created
and returned by this method.init-value, but the
value should not be null. This method should create a new
individual and initialise it with the value(s) packed encoded in
init.
createSpecificIndividual in interface IndividualsFactoryinit - Initialisation value(s) for a new individual.params - Experiment parameters.
init.public Individual createSpecificIndividual(NDecimalsIndividual initVal)
public Individual createSpecificIndividual(BitString initVal)
public Individual createSpecificIndividual(double[] initVal)
private double[] getAllowedRange(int varInd)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
|
JAGA Homepage | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||