org.jscience.mathematics.analysis.optimization
Class PointCostPair

java.lang.Object
  extended by org.jscience.mathematics.analysis.optimization.PointCostPair

public class PointCostPair
extends java.lang.Object

This class holds a point and its associated cost.

A cost/point pair is not evaluated at build time. Its associated cost set to Double.NaN until it is evaluated.

See Also:
CostFunction

Constructor Summary
PointCostPair(double[] point)
          Build a point/cost pair with non-evaluated cost.
 
Method Summary
 double getCost()
          Get the cost.
 double[] getPoint()
          Get the point coordinates.
 boolean isEvaluated()
          Check if the cost has been evaluated.
 void setCost(double cost)
          Set the cost.
 double[] setPoint(double[] point)
          Reset the point coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointCostPair

public PointCostPair(double[] point)
Build a point/cost pair with non-evaluated cost.

Parameters:
point - point coordinates
Method Detail

setPoint

public double[] setPoint(double[] point)
Reset the point coordinates.

Resetting the points coordinates automatically reset the cost to non-evaluated

Parameters:
point - new point coordinates
Returns:
old point coordinates (this can be re-used to put the coordinates of another point without re-allocating an array)

getPoint

public double[] getPoint()
Get the point coordinates.

Returns:
point coordinates

setCost

public void setCost(double cost)
Set the cost.

Parameters:
cost - cost to store in the instance (can be Double.NaN to reset the instance to non-evaluated)

getCost

public double getCost()
Get the cost.

Returns:
cost associated to the point (or Double.NaN if the instance is not evaluated)

isEvaluated

public boolean isEvaluated()
Check if the cost has been evaluated.

The cost is considered to be non-evaluated if it is Double.isNaN(pair.getCost()) would return true

Returns:
true if the cost has been evaluated