net.sourceforge.cilib.problem
Class MOFitness

java.lang.Object
  extended by net.sourceforge.cilib.problem.MOFitness
All Implemented Interfaces:
Serializable, Comparable<Fitness>, Fitness, Type, Cloneable

public class MOFitness
extends Object
implements Fitness

Author:
Edwin Peer
See Also:
Serialized Form

Constructor Summary
MOFitness(MOFitness copy)
           
MOFitness(MOOptimisationProblem problem, Type[] solution, boolean count)
           
MOFitness(MOOptimisationProblem problem, Type solution, boolean count)
           
 
Method Summary
 int compareTo(Fitness other)
          Compare the current fitness instance to the provided instance.
 boolean dominates(MOFitness other)
           
 boolean equals(Object obj)
          Compare the specified object with this type for equality.
 MOFitness getClone()
          Create a cloned copy of the current object and return it.
 int getDimension()
           
 Fitness getFitness(int index)
           
 Double getValue()
          Returns the underlying fitness value.
 int hashCode()
          Returns the hash code value for this list.
 Fitness newInstance(Double value)
          Creation method that maintains Fitness object immutability by returning a new instance of the current class type.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MOFitness

public MOFitness(MOOptimisationProblem problem,
                 Type[] solution,
                 boolean count)

MOFitness

public MOFitness(MOOptimisationProblem problem,
                 Type solution,
                 boolean count)

MOFitness

public MOFitness(MOFitness copy)
Method Detail

getClone

public MOFitness getClone()
Description copied from interface: Fitness
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Fitness
Specified by:
getClone in interface Type
Specified by:
getClone in interface Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

getValue

public Double getValue()
Description copied from interface: Fitness
Returns the underlying fitness value.

Specified by:
getValue in interface Fitness
Returns:
the actual fitness value.

newInstance

public final Fitness newInstance(Double value)
Creation method that maintains Fitness object immutability by returning a new instance of the current class type.

Specified by:
newInstance in interface Fitness
Parameters:
value - The desired value of the Fitness object.

getFitness

public Fitness getFitness(int index)

getDimension

public int getDimension()

dominates

public boolean dominates(MOFitness other)

compareTo

public int compareTo(Fitness other)
Compare the current fitness instance to the provided instance. Returns a negative integer, zero and a positive integer as this object is less than, equal to or greater than the specified object.

Specified by:
compareTo in interface Comparable<Fitness>
Specified by:
compareTo in interface Fitness
Parameters:
other - The fitness to be compared.
Returns:
a negative integer, zero or a positive integer if this object is less than, equal to or greater than the specified object.
See Also:
Comparable

hashCode

public int hashCode()
Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:
  int hashCode = 7;
  Iterator<E> i = list.iterator();
  while (i.hasNext()) {
      E obj = i.next();
      hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
  }
 
This ensures that type1.equals(type2) implies that type1.hashCode()==type2.hashCode() for any two types, type1 and type2, as required by the general contract of Object.hashCode().

Specified by:
hashCode in interface Type
Overrides:
hashCode in class Object
Returns:
the hash code value for this list
See Also:
Object.equals(Object), Type.equals(Object)

equals

public boolean equals(Object obj)
Compare the specified object with this type for equality. Returns true if and only if the specified object is also an instance of the same type.

Specified by:
equals in interface Type
Overrides:
equals in class Object
Parameters:
obj - The object to compare.
Returns:
true if equality exists, false otherwise.
See Also:
Object.equals(Object)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 CIRG. All Rights Reserved.