|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--gpsys.Fitness
|
+--gpsys.lawnmower.LawnMowerFitness
The Fitness class for the lawnmower problem. The fitness is measured using two values. The first is the number of squares on the lawn left uncut when the evolved program has complted. The second value is the complexity of the GP program. The fitness of one GP is is deemed better than another if either the error is smaller or if the error is equal, but the complexity is smaller. The termination criteria is met when the number sqaures left uncut is zero.
| Field Summary | |
(package private) int |
complexity
The complexity of the individual i.e. |
(package private) int |
fitness
The number of uncut squares left on the lawn. |
(package private) Lawn |
lawn
The lawn to be cut. |
(package private) Mower |
mower
|
| Constructor Summary | |
LawnMowerFitness(Lawn lawn,
Mower mower)
Construct a Fitness object with default Fitness. |
|
LawnMowerFitness(Lawn lawn,
Mower mower,
GPParameters gpParameters,
Individual i)
Constructs a Fitness object by evaluating the specified individual. |
|
| Method Summary | |
void |
add(Fitness f)
Adds a fitness value to this fitness value. |
void |
divide(int divisor)
Divide the fitness by the specified integer. |
boolean |
equals(Fitness f)
Tests if this fitness is equal to another fitness. |
boolean |
greaterThan(Fitness f)
Tests if this fitness value is greater than another fitness value. |
Fitness |
instance()
Creates a new instance of the Fitness object with a default fitness. |
Fitness |
instance(GPParameters gpParameters,
Individual i)
Creates a new instance of the Fitness object which represents the fitness of the specified individual. |
boolean |
lessThan(Fitness f)
Tests if this fitness is less than another fitness. |
boolean |
terminationCondition()
Tests whether this fitness meets the termination criteria. |
java.lang.String |
toString()
Converts the fitness into a String suitable for printing. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
int fitness
int complexity
Lawn lawn
Mower mower
| Constructor Detail |
public LawnMowerFitness(Lawn lawn,
Mower mower)
public LawnMowerFitness(Lawn lawn,
Mower mower,
GPParameters gpParameters,
Individual i)
lawn - The lawn to be cut by the mower.mower - The lawnmower to use to cut the grass.gpParameters - The GP parameters for this run.i - The individual to be evaluated.| Method Detail |
public void add(Fitness f)
f - the fitness value to be added.public void divide(int divisor)
divisor - the integer to divide the fitness by.public boolean greaterThan(Fitness f)
f - the fitness with which to compare.public boolean lessThan(Fitness f)
f - the fitness with which to compare.public boolean equals(Fitness f)
f - the fitness with which to compare.public Fitness instance()
public Fitness instance(GPParameters gpParameters,
Individual i)
gpParameters - the parameters for this GP run.i - the individual to be evaluated.public boolean terminationCondition()
public java.lang.String toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||