net.usa.rharder.tabusearch22
Interface TSFunction


public interface TSFunction

This generic function can be used for anything that evaluates a TSSolution. The evaluate method is required.

Generally this class will be extended to define an objective function and a constraint penalties function. These two objects should return an array of equal length. Their results are added together, element by element, to obtain a final solution value.

Since:
2.1

Method Summary
 double[] evaluate(TSSolution soln)
          The Tabu Search TSEngine expects an objective function and constraint penalties function to be able to evaluate its own worth.
 

Method Detail

evaluate

public double[] evaluate(TSSolution soln)
The Tabu Search TSEngine expects an objective function and constraint penalties function to be able to evaluate its own worth. The TSEngine will pass the TSFunction a TSSolution. The TSFunction will then need to cast the TSSolution to its own solution type.

Casting example:
public float evaluate( TSSolution soln )
{
MySolutionClass solution = (MySolutionClass) soln;
// continue with evaluation

The array of returned values will later be compared lexicographically in the classic "goal-programming" style. If you want some goals to overpower higher goals, use the style of weighting the levels with appropriate values. Although all numbers are stored and calculated as doubles, they are cast to floats before being compared.

Parameters:
soln - An object of type TSSolution.
Returns:
The function's value.
Since:
2.1
See Also:
TSSolution