net.sourceforge.cilib.problem
Class OptimisationSolution

java.lang.Object
  extended by net.sourceforge.cilib.problem.OptimisationSolution
All Implemented Interfaces:
Serializable, Comparable<OptimisationSolution>, Solution

public class OptimisationSolution
extends Object
implements Solution, Comparable<OptimisationSolution>

This class represents a solution to an OptimisationProblem. It is responsible for keeping track of the optimisation problem and position of the solution within the search space.

Author:
Edwin Peer
See Also:
Serialized Form

Constructor Summary
OptimisationSolution(Type position, Fitness fitness)
          Constructs a new instance of OptimisationSolution.
 
Method Summary
 int compareTo(OptimisationSolution other)
          
 boolean equals(Object other)
           
 Fitness getFitness()
          Returns the fitness of this solution according to OptimisationProblem.getFitness(Type, boolean).
 Type getPosition()
          Returns the position of this solution within the search space of the problem.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimisationSolution

public OptimisationSolution(Type position,
                            Fitness fitness)
Constructs a new instance of OptimisationSolution.

Parameters:
position - The position of the solution within the search space of the problem.
fitness - The fitness of the optimisation solution.
Method Detail

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getPosition

public Type getPosition()
Returns the position of this solution within the search space of the problem.

Returns:
The position of this solution in search space.

getFitness

public Fitness getFitness()
Returns the fitness of this solution according to OptimisationProblem.getFitness(Type, boolean). Calling this function does not contribute to the number of fitness evaulations maintained by OptimisationProblem.

Returns:
The fitness of this solution.

compareTo

public int compareTo(OptimisationSolution other)

Specified by:
compareTo in interface Comparable<OptimisationSolution>


Copyright © 2009 CIRG. All Rights Reserved.