Package algs13.xbacktrack.xframework
Interface XBacktrackProblem<T>
- Type Parameters:
T
- The type of the choices made in the backtracking problem.
- All Known Implementing Classes:
MySudoku
public interface XBacktrackProblem<T>
A interface defining a backtracking problem to be solved with the backtracking
framework.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine if the backtracking driver can advance in searching for a solution from the state represented by previous choice.void
initialize
(MyBacktrackDriver<T> driver) Initialize the problem.
-
Method Details
-
initialize
Initialize the problem. The initialize method must call the track method on the driver to track the starting state.- Parameters:
driver
- The driver orchestrating the search for the solution.
-
advance
Determine if the backtracking driver can advance in searching for a solution from the state represented by previous choice. If it can, this method must either call the track method on the driver to track the next choice, or it must call the driver's setDone() method.- Parameters:
state
- The previous choice- Returns:
- true if the current state consists of a valid partial solution, or the current state represents a complete solution (i.e. the last choice required to solve the problem has been made).
-