|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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 |
public double[] evaluate(TSSolution soln)
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 double
s,
they are cast to float
s before being compared.
soln
- An object of type TSSolution
.TSSolution
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |