Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <max_hs.h>
Public Member Functions | |
HittingSetOptimizer (const CpModelProto &model_proto, const ObjectiveDefinition &objective_definition, const std::function< void()> &feasible_solution_observer, Model *model) | |
SatSolver::Status | Optimize () |
Generalization of the max-HS algorithm (HS stands for Hitting Set). This is similar to MinimizeWithCoreAndLazyEncoding() but it uses a hybrid approach with a MIP solver to handle the discovered infeasibility cores.
See, Jessica Davies and Fahiem Bacchus, "Solving MAXSAT by Solving a Sequence of Simpler SAT Instances", http://www.cs.toronto.edu/~jdavies/daviesCP11.pdf"
operations_research::sat::HittingSetOptimizer::HittingSetOptimizer | ( | const CpModelProto & | model_proto, |
const ObjectiveDefinition & | objective_definition, | ||
const std::function< void()> & | feasible_solution_observer, | ||
Model * | model ) |
SatSolver::Status operations_research::sat::HittingSetOptimizer::Optimize | ( | ) |
This is the "generalized" hitting set problem we will solve. Each time we find a core, a new constraint will be added to this problem.
This is used by the "stratified" approach. We will only consider terms with a weight not lower than this threshold. The threshold will decrease as the algorithm progress.
Start the algorithm.
Get the best external bound and constraint the objective of the MPModel.
We currently abort if we have a non-optimal result. This is correct if we had a limit reached, but not in the other cases.
Update the objective lower bound with our current bound.
Note(user): This is not needed for correctness, but it might cause more propagation and is nice to have for reporting/logging purpose.
No assumptions with the current stratified_threshold? use the new one.
If not all assumptions were taken, continue with a lower stratified bound. Otherwise we have an optimal solution.
Hack: we use a local limit internally that we restore at the end. However we still return LIMIT_REACHED in this case...