org.opt4j.core
Class Objectives

java.lang.Object
  extended by org.opt4j.core.Objectives
All Implemented Interfaces:
java.lang.Iterable<java.util.Map.Entry<Objective,Value<?>>>

public class Objectives
extends java.lang.Object
implements java.lang.Iterable<java.util.Map.Entry<Objective,Value<?>>>

The Objectives contains the Objective-Values pairs of an Individual.

See Also:
Value, Objective

Field Summary
protected  double[] array
           
protected  java.util.SortedMap<Objective,Value<?>> map
           
 
Constructor Summary
Objectives()
           
 
Method Summary
 void add(Objective objective, double value)
          Adds the objective with the specified double value.
 void add(Objective objective, int value)
          Adds the objective with the specified integer value.
 void add(Objective objective, Value<?> value)
          Adds the objective with the specified value.
 void add(java.lang.String name, Objective.Sign sign, double value)
          Adds the objective with the specified value.
 void add(java.lang.String name, Objective.Sign sign, int value)
          Adds the objective with the specified value.
 void add(java.lang.String name, Objective.Sign sign, Value<?> value)
          Adds the objective with the specified value.
 void addAll(Objectives objectives)
          Adds all objective with the specified value specified in Objectives.
 double[] array()
          Returns an array of all values which all have to be minimized.
 double distance(Objectives other)
          Calculates the euclidean distance of two Objectives.
 boolean dominates(Objectives opponent)
          Returns true if this objectives dominate the specified objectives.
 Value<?> get(Objective objective)
          Returns the value that is assigned to the given objective.
 Objective get(Value<?> value)
          Returns the objective that is assigned to the given value.
 java.util.Collection<Objective> getKeys()
          Returns all objectives.
 java.util.Collection<Value<?>> getValues()
          Returns all values.
 boolean isEqual(Objectives opponent)
          Returns true if this objectives are equal to the specified objectives.
 java.util.Iterator<java.util.Map.Entry<Objective,Value<?>>> iterator()
           
 int size()
          Returns the number of set Objectives.
protected  void submit()
          Calculates the array.
 java.lang.String toString()
           
 boolean weaklyDominates(Objectives opponent)
          Returns true if this objectives weakly dominates the specified objectives.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

map

protected final java.util.SortedMap<Objective,Value<?>> map

array

protected double[] array
Constructor Detail

Objectives

public Objectives()
Method Detail

iterator

public java.util.Iterator<java.util.Map.Entry<Objective,Value<?>>> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.util.Map.Entry<Objective,Value<?>>>

array

public double[] array()
Returns an array of all values which all have to be minimized. Do not call this method before all objectives were added!

Returns:
an array containing values which have to be minimized
See Also:
Value.getDouble()

submit

protected void submit()
Calculates the array.


size

public int size()
Returns the number of set Objectives.

Returns:
the number of set objectives

getKeys

public java.util.Collection<Objective> getKeys()
Returns all objectives.

Returns:
all objectives

getValues

public java.util.Collection<Value<?>> getValues()
Returns all values.

Returns:
all values

get

public Value<?> get(Objective objective)
Returns the value that is assigned to the given objective. Returns null if the objective does not exist.

Parameters:
objective - the given objective
Returns:
the value

get

public Objective get(Value<?> value)
Returns the objective that is assigned to the given value. Returns null if the value does not exist.

Parameters:
value - the given value
Returns:
the objective

add

public void add(Objective objective,
                Value<?> value)
Adds the objective with the specified value.

Parameters:
objective - the objective
value - the value

add

public void add(java.lang.String name,
                Objective.Sign sign,
                Value<?> value)
Adds the objective with the specified value.

Parameters:
name - the name of the objective
sign - the optimization direction
value - the value

add

public void add(Objective objective,
                double value)
Adds the objective with the specified double value.

Parameters:
objective - the objective
value - the value

add

public void add(java.lang.String name,
                Objective.Sign sign,
                double value)
Adds the objective with the specified value.

Parameters:
name - the name of the objective
sign - the optimization direction
value - the value

add

public void add(Objective objective,
                int value)
Adds the objective with the specified integer value.

Parameters:
objective - the objective
value - the value

add

public void add(java.lang.String name,
                Objective.Sign sign,
                int value)
Adds the objective with the specified value.

Parameters:
name - the name of the objective
sign - the optimization direction
value - the value

addAll

public void addAll(Objectives objectives)
Adds all objective with the specified value specified in Objectives.

Parameters:
objectives - the objectives

weaklyDominates

public boolean weaklyDominates(Objectives opponent)
Returns true if this objectives weakly dominates the specified objectives. This comparison is based on the array() values.

Parameters:
opponent - other objectives
Returns:
true if this objectives weakly dominate the opponent

dominates

public boolean dominates(Objectives opponent)
Returns true if this objectives dominate the specified objectives. This comparison is based on the array() values.

Parameters:
opponent - other objectives
Returns:
true if these objectives dominate the opponent

isEqual

public boolean isEqual(Objectives opponent)
Returns true if this objectives are equal to the specified objectives. This comparison is based on the array() values.

Parameters:
opponent - other objectives
Returns:
true if these objectives dominate the opponent

distance

public double distance(Objectives other)
Calculates the euclidean distance of two Objectives. This calculation is based on the array() values.

Parameters:
other - the second objectives
Returns:
the euclidean distance

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object