public class RuleIndividual extends Individual
RuleIndividuals really have basically one parameter: the number of RuleSets to use. This is determined by the num-rulesets parameter.
From ec.Individual:
In addition to serialization for checkpointing, Individuals may read and write themselves to streams in three ways.
In general, the various readers and writers do three things: they tell the Fitness to read/write itself, they read/write the evaluated flag, and they read/write the Rulesets. If you add instance variables to a RuleIndividual or subclass, you'll need to read/write those variables as well.
Parameters
| base.num-rulesets int >= 1 |
(number of rulesets used) |
| base.ruleset.n Classname, subclass of or = ec.rule.RuleSet |
(class of ruleset n) |
Parameter bases
| base.ruleset.n | RuleSet n |
Default Base
rule.individual
| Modifier and Type | Field and Description |
|---|---|
static String |
P_NUMRULESETS |
static String |
P_RULESET |
RuleSet[] |
rulesets
The individual's rulesets.
|
private static long |
serialVersionUID |
evaluated, EVALUATED_PREAMBLE, fitness, P_INDIVIDUAL, species| Constructor and Description |
|---|
RuleIndividual() |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates a new individual cloned from a prototype,
and suitable to begin use in its own evolutionary
context.
|
Parameter |
defaultBase()
Returns the default base for this prototype.
|
boolean |
equals(Object ind)
Returns true if I am genetically "equal" to ind.
|
int |
hashCode()
Returns a hashcode for the individual, such that individuals which
are equals(...) each other always return the same
hash code.
|
void |
mutate(EvolutionState state,
int thread)
Mutates the Individual.
|
void |
parseGenotype(EvolutionState state,
LineNumberReader reader)
Overridden for the RuleIndividual genotype.
|
void |
postprocessIndividual(EvolutionState state,
int thread)
Called by pipelines after they've modified the individual and
it might need to be "fixed" -- basically a hook for you to override.
|
void |
preprocessIndividual(EvolutionState state,
int thread)
Called by pipelines before they've modified the individual and
it might need to be "fixed" -- basically a hook for you to override.
|
void |
printIndividual(EvolutionState state,
int log)
Should print the individual in a way that can be read by computer,
including its fitness, with a verbosity of Output.V_NO_GENERAL.
|
void |
printIndividual(EvolutionState state,
PrintWriter writer)
Overridden for the RuleIndividual genotype, writing each ruleset in turn.
|
void |
printIndividualForHumans(EvolutionState state,
int log)
Should print the individual out in a pleasing way for humans,
with a verbosity of Output.V_NO_GENERAL.
|
void |
readGenotype(EvolutionState state,
DataInput dataInput)
Overridden for the RuleIndividual genotype.
|
void |
reset(EvolutionState state,
int thread) |
void |
setup(EvolutionState state,
Parameter base)
This should be used to set up only those things which you share in common
with all other individuals in your species; individual-specific items
which make you you should be filled in by Species.newIndividual(...),
and modified by breeders.
|
long |
size()
Returns the "size" of the individual.
|
void |
writeGenotype(EvolutionState state,
DataOutput dataOutput)
Overridden for the RuleIndividual genotype, writing each ruleset in turn.
|
compareTo, distanceTo, genotypeToString, genotypeToStringForHumans, merge, printIndividual, printIndividualForHumans, readIndividual, readIndividual, toString, writeIndividualprivate static final long serialVersionUID
public static final String P_RULESET
public static final String P_NUMRULESETS
public RuleSet[] rulesets
public Parameter defaultBase()
Prototypepublic Object clone()
PrototypeTypically this should be a full "deep" clone. However, you may share certain elements with other objects rather than clone hem, depending on the situation:
Implementations.
public Object clone()
{
try
{
return super.clone();
}
catch ((CloneNotSupportedException e)
{ throw new InternalError(); } // never happens
}
public Object clone()
{
try
{
MyObject myobj = (MyObject) (super.clone());
// put your deep-cloning code here...
}
catch ((CloneNotSupportedException e)
{ throw new InternalError(); } // never happens
return myobj;
}
public Object clone()
{
MyObject myobj = (MyObject) (super.clone());
// put your deep-cloning code here...
return myobj;
}
clone in interface Prototypeclone in class Individualpublic void preprocessIndividual(EvolutionState state, int thread)
public void postprocessIndividual(EvolutionState state, int thread)
public boolean equals(Object ind)
Individualequals in class Individualpublic int hashCode()
IndividualhashCode in class Individualpublic void setup(EvolutionState state, Parameter base)
Individualsetup in interface Prototypesetup in interface Setupsetup in class IndividualPrototype.setup(EvolutionState,Parameter)public void printIndividualForHumans(EvolutionState state, int log)
IndividualprintIndividualForHumans in class Individualpublic void printIndividual(EvolutionState state, int log)
IndividualprintIndividual in class Individualpublic void printIndividual(EvolutionState state, PrintWriter writer)
printIndividual in class Individualpublic void writeGenotype(EvolutionState state, DataOutput dataOutput) throws IOException
writeGenotype in class IndividualIOExceptionpublic void readGenotype(EvolutionState state, DataInput dataInput) throws IOException
readGenotype in class IndividualIOExceptionpublic void parseGenotype(EvolutionState state, LineNumberReader reader) throws IOException
parseGenotype in class IndividualIOExceptionpublic long size()
Individualsize in class Individualpublic void reset(EvolutionState state, int thread)
public void mutate(EvolutionState state, int thread)
Copyright © 2014 Evolutionary Computation Laboratory at George Mason University. All rights reserved.