Package org.ddolib.ddo.core.frontier
Class SimpleFrontier<T>
java.lang.Object
org.ddolib.ddo.core.frontier.SimpleFrontier<T>
- Type Parameters:
T- the type of state in the subproblems
- All Implemented Interfaces:
Frontier<T>
A simple implementation of a
Frontier for a solver, based on a plain priority queue.
The SimpleFrontier maintains a collection of SubProblem instances, which are pushed
and popped by the solver according to their priority determined by a StateRanking.
This frontier supports cutset-based compilation strategies.
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleFrontier(StateRanking<T> ranking, CutSetType cutSetType) Constructs a newSimpleFrontier. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the best (lowest) lower bound among the subproblems in the frontier.voidclear()Clears all subproblems from the frontier.Returns the type of cutset used in the frontier.pop()Removes and returns the most promising subproblem from the frontier.voidpush(SubProblem<T> sub) Adds a subproblem to the frontier.intsize()Returns the number of subproblems currently in the frontier.toString()
-
Constructor Details
-
SimpleFrontier
Constructs a newSimpleFrontier.- Parameters:
ranking- the ordering used to determine which subproblem is most promising and should be explored firstcutSetType- the type of cutset to use:CutSetType.LastExactLayerorCutSetType.Frontier
-
-
Method Details
-
push
Adds a subproblem to the frontier. -
pop
Removes and returns the most promising subproblem from the frontier. -
clear
public void clear()Clears all subproblems from the frontier. -
size
public int size()Returns the number of subproblems currently in the frontier. -
cutSetType
Returns the type of cutset used in the frontier.- Specified by:
cutSetTypein interfaceFrontier<T>- Returns:
- the cutset type
-
toString
-
bestInFrontier
public double bestInFrontier()Returns the best (lowest) lower bound among the subproblems in the frontier.- Specified by:
bestInFrontierin interfaceFrontier<T>- Returns:
- the lower bound of the most promising subproblem
-