A BlackBoxSearch executes a sequence of configured phases, each phase
being a
RunnableSearch with a relative time budget. The class stores and
propagates incumbents
(solution and objective value), handles early stopping criteria, and merges
per-phase statuses
into a global status.
Time-share semantics:
- Each phase has a
timeSharein(0,1]. - Configured shares must sum to at most
1.0(not necessarily exactly1.0). - If shares sum to less than
1.0, the remaining budget is assigned to the last phase in the configured sequence when that phase is reached. - The actual per-phase budget is always capped by the currently remaining global time.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordConfiguration for exhaustive DFS/FDS phase.static enumStrategy used to choose which decision variables are frozen in each LNS restart.static final recordConfiguration for LNS improvement phase.static final recordConfiguration for restart-based feasibility phase.static enumLogging granularity for phase execution. -
Constructor Summary
ConstructorsConstructorDescriptionBlackBoxSearch(ModelDispatcher model) Creates a feasibility black-box search with automatic decision-variable inference.BlackBoxSearch(ModelDispatcher model, List<IntExpression> vars, Objective objective) Creates a black-box search on decision variables with an objective (optimization).BlackBoxSearch(ModelDispatcher model, IntExpression[] vars) Creates a black-box search on decision variables without objective (feasibility).BlackBoxSearch(ModelDispatcher model, IntExpression[] vars, Objective objective) Creates a black-box search on an array of decision variables with an objective (optimization).BlackBoxSearch(ModelDispatcher model, Objective objective) Creates a black-box search with automatic decision-variable inference. -
Method Summary
Modifier and TypeMethodDescriptionaddPhase(String name, RunnableSearch search, double timeShare, boolean requiresFeasible) Registers one executable phase in the black-box plan.Returns the incumbent objective value, if any.Returns the best incumbent solution found so far, if any.Returns phase names that were actually executed (in execution order).start(int timeLimitInSeconds) Executes the configured phase plan under a global timeout.voidupdateObjective(Integer objectiveValue) voidupdateSolution(List<Integer> solution) Builds the built-in default plan.withFeasibilityPlan(BlackBoxSearch.RestartPhaseOptions restart, BlackBoxSearch.ExhaustivePhaseOptions exhaustive, double initialExhaustiveShare, double restartShare, double exhaustiveShare) Configures the feasibility phase plan explicitly.withOptimizationPlan(BlackBoxSearch.RestartPhaseOptions restart, BlackBoxSearch.LnsPhaseOptions lns, BlackBoxSearch.ExhaustivePhaseOptions exhaustive, double initialExhaustiveShare, double restartShare, double lnsShare, double exhaustiveShare) Configures the optimization phase plan explicitly.withVerbosity(BlackBoxSearch.Verbosity verbosity) Sets logging verbosity for this search.
-
Constructor Details
-
BlackBoxSearch
Creates a black-box search on decision variables with an objective (optimization). -
BlackBoxSearch
Creates a black-box search with automatic decision-variable inference.The variables are obtained from
ModelDispatcher.getDecisionVariables(). This is convenient for LNS users who want to freeze only real decision variables and avoid freezing derived expressions. -
BlackBoxSearch
Creates a black-box search on an array of decision variables with an objective (optimization). -
BlackBoxSearch
Creates a black-box search on decision variables without objective (feasibility). -
BlackBoxSearch
Creates a feasibility black-box search with automatic decision-variable inference.
-
-
Method Details
-
withVerbosity
Sets logging verbosity for this search. -
addPhase
public BlackBoxSearch addPhase(String name, RunnableSearch search, double timeShare, boolean requiresFeasible) Registers one executable phase in the black-box plan.- Parameters:
name- descriptive phase name used in logs and diagnosticssearch- runnable implementation executed for the phasetimeShare- relative share of the global timeout allocated to this phase for non-last phases (must be in(0,1]; shares across phases must sum to at most1.0)requiresFeasible- whether this phase can run only after an incumbent exists- Returns:
- this search instance for fluent configuration
-
withDefaultPhasePlan
Builds the built-in default plan.Feasibility: initial exhaustive + restart phases.
Optimization: initial exhaustive + restart + LNS + exhaustive phases.
-
withOptimizationPlan
public BlackBoxSearch withOptimizationPlan(BlackBoxSearch.RestartPhaseOptions restart, BlackBoxSearch.LnsPhaseOptions lns, BlackBoxSearch.ExhaustivePhaseOptions exhaustive, double initialExhaustiveShare, double restartShare, double lnsShare, double exhaustiveShare) Configures the optimization phase plan explicitly.Shares do not need to sum to exactly
1.0; they must sum to at most1.0. Any remaining fraction is effectively left to the last configured phase via remaining-time assignment. -
withFeasibilityPlan
public BlackBoxSearch withFeasibilityPlan(BlackBoxSearch.RestartPhaseOptions restart, BlackBoxSearch.ExhaustivePhaseOptions exhaustive, double initialExhaustiveShare, double restartShare, double exhaustiveShare) Configures the feasibility phase plan explicitly.Shares do not need to sum to exactly
1.0; they must sum to at most1.0. Any remaining fraction is effectively left to the last configured phase via remaining-time assignment. -
start
Executes the configured phase plan under a global timeout.Early stop conditions:
- Feasibility mode: stops on first feasible solution.
- Any mode: stops on
SearchStatus.PROVEN_OPTIMALorSearchStatus.UNSAT.
- Parameters:
timeLimitInSeconds- global timeout in seconds- Returns:
- merged global status across executed phases
-
bestSolution
Returns the best incumbent solution found so far, if any. -
bestObjectiveValue
Returns the incumbent objective value, if any. -
executedPhases
Returns phase names that were actually executed (in execution order). -
updateObjective
-
updateSolution
-
getRunnableSearches
-