Interface Frontier<T>
- Type Parameters:
T- the type representing the problem state stored in eachSubProblem
- All Known Implementing Classes:
SimpleFrontier
In a Decision Diagram (DD) or branch-and-bound framework, the frontier represents the set of active subproblems—those that have been generated but not yet expanded or solved. Each subproblem corresponds to a node in the search or DD exploration tree.
Implementations of this interface define how the solver selects the next node to explore. The typical behavior is to always extract the most promising node (the one with the highest bound on the objective function) to maximize pruning efficiency.
Contract:
- Nodes (subproblems) are pushed into the frontier using
push(SubProblem). - Nodes are extracted in descending order of upper bound value using
pop(). - Implementations must maintain this priority invariant to ensure correct solver behavior.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the current best upper bound among all subproblems stored in the frontier.voidclear()Removes all subproblems currently stored in the frontier.Returns the type of cut set associated with this frontier.default booleanisEmpty()Checks whether the frontier is empty.pop()Extracts and returns the most promising subproblem from the frontier.voidpush(SubProblem<T> sub) Adds a new subproblem to the frontier for future exploration.intsize()Returns the number of subproblems currently stored in the frontier.
-
Method Details
-
push
Adds a new subproblem to the frontier for future exploration.This method inserts a node into the internal priority structure of the frontier (e.g., a priority queue ordered by the subproblem’s upper bound or heuristic value).
- Parameters:
sub- the subproblem to be added to the frontier
-
pop
SubProblem<T> pop()Extracts and returns the most promising subproblem from the frontier.The solver assumes that subproblems are popped in descending order of upper bound, i.e., the node with the best potential objective value should be returned first.
If the frontier is empty, this method may return
null.- Returns:
- the subproblem with the highest priority in the frontier, or
nullif empty
-
clear
void clear()Removes all subproblems currently stored in the frontier.This operation resets the internal structure and is typically used when restarting a search or reinitializing the solver.
-
size
int size()Returns the number of subproblems currently stored in the frontier.- Returns:
- the number of nodes in the frontier
-
cutSetType
CutSetType cutSetType()Returns the type of cut set associated with this frontier.The cut set type determines the strategy used to define which nodes belong to the frontier (e.g.,
CutSetType.LastExactLayerorCutSetType.Frontier). This affects how the solver manages layers during compilation.- Returns:
- the
CutSetTyperepresenting the frontier strategy
-
isEmpty
default boolean isEmpty()Checks whether the frontier is empty.This default implementation returns
trueifsize()is zero.- Returns:
trueif the frontier contains no subproblems;falseotherwise
-
bestInFrontier
double bestInFrontier()Returns the current best upper bound among all subproblems stored in the frontier.The "best" bound depends on the problem type (e.g., maximum upper bound for minimization problems). This method is generally used by the solver to monitor convergence or update global bounds.
Note: Implementations should throw an exception if this method is called when the frontier is empty.
- Returns:
- the best upper bound value among subproblems in the frontier
- Throws:
IllegalStateException- if the frontier is empty
-