jopt.csp.search
Interface Metaheuristic


public interface Metaheuristic

Used to guide a local search regarding which moves can be taken.


Method Summary
 boolean continueSearch()
          Called after the solver has failed to find a solution to determine if changes can be made by the metaheuristic to allow additional searching to be performed
 boolean isAcceptableNeighbor(SolverSolution neighbor)
          Used to check the validity of the specified neighbor.
 boolean isRestoredNeighborValid(SolverSolution neighbor)
          Notifies the metaheuristic that a neighboring solution has just been restored to the problem allowing the heuristic to determine if the move has produced an allowed result.
 void neighborSelected(SolverSolution neighbor)
          Called when a current neighbor has been selected to allow metaheuristic to store data that will determine how future neighbors will be selected.
 boolean setInitialSolution(SolverSolution initial)
          Sets the initial solution for this metaheuristic
 

Method Detail

setInitialSolution

public boolean setInitialSolution(SolverSolution initial)
                           throws PropagationFailureException
Sets the initial solution for this metaheuristic

Parameters:
initial - Initial solution that will be used as new basis for the metaheuristic
Returns:
False if solution is an unacceptable solution and no movements should be allowed
Throws:
PropagationFailureException - When unable to post constraints improving the objective

isAcceptableNeighbor

public boolean isAcceptableNeighbor(SolverSolution neighbor)
Used to check the validity of the specified neighbor. This method returns false if the metaheuristic can determine that the neighbor will be of no value, and it does so without requiring all the work of actually restoring the solution.

Parameters:
neighbor - Neighbor to check if acceptable
Returns:
True if neighbor is acceptable to restore

isRestoredNeighborValid

public boolean isRestoredNeighborValid(SolverSolution neighbor)
Notifies the metaheuristic that a neighboring solution has just been restored to the problem allowing the heuristic to determine if the move has produced an allowed result.

Parameters:
neighbor - Neighbor that was restored to problem
Returns:
True if neighbor produced a valid solution

neighborSelected

public void neighborSelected(SolverSolution neighbor)
Called when a current neighbor has been selected to allow metaheuristic to store data that will determine how future neighbors will be selected. This method is called before the initial solution has been altered.

Parameters:
neighbor - Neighbor that was selected

continueSearch

public boolean continueSearch()
Called after the solver has failed to find a solution to determine if changes can be made by the metaheuristic to allow additional searching to be performed

Returns:
True if searching should continue