All Packages Class Hierarchy This Package Previous Next Index
Class gpsys.cos.CosSimFitness
java.lang.Object
|
+----gpsys.Fitness
|
+----gpsys.cos.CosSimFitness
- public class CosSimFitness
- extends Fitness
The Fitness class for the terrain robot problem. The fitness is
measured using several values. The first is the number of time spent on the terrain
when the evolved program has completed. The second value is
the energy left in the robot, number of lamps not maxed. The fitness of one GP 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 robot is dead,
the lamps are all maxed, or no energy is left in the system.
- Author:
- Emmanuel PIERRE
DEA IARFA,
-
complexity
- The complexity of the individual i.e.
-
fitness
- The time lived on the terrain.
-
robot
-
-
terrain
- The terrain to be cut.
-
CosSimFitness(Terrain, Robot)
- Construct a Fitness object with default Fitness.
-
CosSimFitness(Terrain, Robot, GPParameters, Individual)
- Constructs a Fitness object by evaluating the specified individual.
-
add(Fitness)
- Adds a fitness value to this fitness value.
-
divide(int)
- Divide the fitness by the specified integer.
-
equals(Fitness)
- Tests if this fitness is equal to another fitness.
-
greaterThan(Fitness)
- Tests if this fitness value is greater than another fitness value.
-
instance()
- Creates a new instance of the Fitness object with a default fitness.
-
instance(GPParameters, Individual)
- Creates a new instance of the Fitness object which represents the
fitness of the specified individual.
-
lessThan(Fitness)
- Tests if this fitness is less than another fitness.
-
terminationCondition()
- Tests whether this fitness meets the termination criteria.
-
toString()
- Converts the fitness into a String suitable for printing.
fitness
int fitness
- The time lived on the terrain.
complexity
int complexity
- The complexity of the individual i.e. the number of Genes it contains.
terrain
Terrain terrain
- The terrain to be cut.
robot
Robot robot
CosSimFitness
public CosSimFitness(Terrain terrain,
Robot robot)
- Construct a Fitness object with default Fitness.
CosSimFitness
public CosSimFitness(Terrain terrain,
Robot robot,
GPParameters gpParameters,
Individual i)
- Constructs a Fitness object by evaluating the specified individual.
The raw fitness is the time spent on the terrain, the robot alived, and
the number of lamps not maxed when the GP evolved code has executed.
- Parameters:
- terrain - The terrain to be proceeded by the robot.
- robot - The terrain robot to use.
- gpParameters - The GP parameters for this run.
- i - The individual to be evaluated.
add
public void add(Fitness f)
- Adds a fitness value to this fitness value.
- Parameters:
- f - the fitness value to be added.
- Overrides:
- add in class Fitness
divide
public void divide(int divisor)
- Divide the fitness by the specified integer. This is used by the
GP system to calculate the average fitness of the population.
- Parameters:
- divisor - the integer to divide the fitness by.
- Overrides:
- divide in class Fitness
greaterThan
public boolean greaterThan(Fitness f)
- Tests if this fitness value is greater than another fitness value.
- Parameters:
- f - the fitness with which to compare.
- Returns:
- true if f has higher fitness, false otherwise.
- Overrides:
- greaterThan in class Fitness
lessThan
public boolean lessThan(Fitness f)
- Tests if this fitness is less than another fitness.
- Parameters:
- f - the fitness with which to compare.
- Returns:
- true if f has less fitness, false otherwise.
- Overrides:
- lessThan in class Fitness
equals
public boolean equals(Fitness f)
- Tests if this fitness is equal to another fitness.
- Parameters:
- f - the fitness with which to compare.
- Returns:
- true if f has the same fitness, false otherwise.
- Overrides:
- equals in class Fitness
instance
public Fitness instance()
- Creates a new instance of the Fitness object with a default fitness.
Note that the same Terrain and Robot are used in the new instance.
- Returns:
- an instance of a Fitness object with default fitness.
- Overrides:
- instance in class Fitness
instance
public Fitness instance(GPParameters gpParameters,
Individual i)
- Creates a new instance of the Fitness object which represents the
fitness of the specified individual.
Note that the same Terrain and Robot are used in the new instance.
- Parameters:
- gpParameters - the parameters for this GP run.
- i - the individual to be evaluated.
- Returns:
- The Fitness of the specified individual.
- Overrides:
- instance in class Fitness
terminationCondition
public boolean terminationCondition()
- Tests whether this fitness meets the termination criteria.
- Returns:
- true if the termination criteria has been met, false otherwise.
- Overrides:
- terminationCondition in class Fitness
toString
public String toString()
- Converts the fitness into a String suitable for printing.
- Returns:
- A String representing the fitness.
- Overrides:
- toString in class Fitness
All Packages Class Hierarchy This Package Previous Next Index