net.usa.rharder.tabusearch22
Class TSSolution

java.lang.Object
  |
  +--net.usa.rharder.tabusearch22.TSSolution
All Implemented Interfaces:
java.lang.Cloneable

public abstract class TSSolution
extends java.lang.Object
implements java.lang.Cloneable

The user has complete flexibility in describing a solution. It could be an array of integers or booleans. It could be a collection of objects, some "active" and some not. The important thing is that it stand on its own. As solutions get evaluated here and there in the engine, it is necessary that a solution object be able to completely describe its state, especially if incremental techniques are used to save processing time.

Since:
2.1

Constructor Summary
TSSolution()
          Empty constructor
TSSolution(TSSolution copyThis)
          Aids in cloning.
 
Method Summary
abstract  java.lang.Object clone()
          A common Java method that returns of copy of the object.
 double[] getObjectiveValue()
          This is the value without the penalties.
 double[] getPenaltyValue()
          Gets the value of the penalties for the solution.
 double[] getValue()
          If the value has been set for this solution, then the value will be returned.
 void setObjectiveValue(double[] objValue)
          Generally used by the TSEngine to set the value of the objective function (without penalties).
 void setPenaltyValue(double[] penValue)
          Generally used by the TSEngine to set the penalties for the solution.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TSSolution

public TSSolution()
Empty constructor

TSSolution

public TSSolution(TSSolution copyThis)
Aids in cloning. Call super( copyThis ) in a constructor to copy the objective and penalty function values.
Parameters:
copyThis - solution to copy.
Method Detail

clone

public abstract java.lang.Object clone()
A common Java method that returns of copy of the object. This should do whatever is necessary to ensure that the returned TSSolution is identical to this
Overrides:
clone in class java.lang.Object
Returns:
A copy of this.

getValue

public final double[] getValue()
If the value has been set for this solution, then the value will be returned. Be careful if this returns zero since this may indicate that the TSEngine has not yet set the solution's value.
Returns:
The value of the solution (this).

setObjectiveValue

public final void setObjectiveValue(double[] objValue)
Generally used by the TSEngine to set the value of the objective function (without penalties).
Parameters:
objValue - The objective function value.

getObjectiveValue

public final double[] getObjectiveValue()
This is the value without the penalties. The objective function evaluates this value. Be careful if the value is zero. This could be the actual value, or it could be that the solution has not yet been evaluated.
Returns:
The objective function value or zero if the value has not been set.

setPenaltyValue

public final void setPenaltyValue(double[] penValue)
Generally used by the TSEngine to set the penalties for the solution.
Parameters:
penValue - The value of the penalties.

getPenaltyValue

public final double[] getPenaltyValue()
Gets the value of the penalties for the solution. Be careful if the value is zero. It could indicate that the solution has not been evaluated or the penalties really could be zero.
Returns:
The value for the penalties.