14#ifndef OR_TOOLS_SAT_OPTIMIZATION_H_
15#define OR_TOOLS_SAT_OPTIMIZATION_H_
20#include "absl/types/span.h"
27#include "ortools/sat/sat_parameters.pb.h"
44 std::vector<Literal>* core);
47 std::vector<Literal>* core);
53 std::vector<Literal>* core);
65 IntegerVariable objective_var,
66 const std::function<
void()>& feasible_solution_observer, Model*
model);
71 IntegerVariable objective_var,
72 const std::function<
void()>& feasible_solution_observer, Model*
model);
96 absl::Span<const IntegerVariable> variables,
98 std::function<
void()> feasible_solution_observer,
117 absl::Span<const Literal> literals,
118 absl::Span<const IntegerVariable> vars,
119 absl::Span<const Coefficient>
coefficients, Coefficient offset);
125 struct ObjectiveTerm {
129 IntegerValue old_var_lb;
133 IntegerValue cover_ub;
139 bool ProcessSolution();
143 bool PropagateObjectiveBounds();
147 bool CoverOptimization();
151 void ComputeNextStratificationThreshold();
165 void PresolveObjectiveWithAtMostOne(std::vector<Literal>* literals,
167 Coefficient* offset);
169 SatParameters* parameters_;
178 IntegerVariable objective_var_;
179 std::vector<ObjectiveTerm> terms_;
180 IntegerValue stratification_threshold_;
181 std::function<void()> feasible_solution_observer_;
185 bool already_switched_to_linear_scan_ =
false;
SatSolver::Status OptimizeWithSatEncoding(absl::Span< const Literal > literals, absl::Span< const IntegerVariable > vars, absl::Span< const Coefficient > coefficients, Coefficient offset)
SatSolver::Status Optimize()
CoreBasedOptimizer(IntegerVariable objective_var, absl::Span< const IntegerVariable > variables, absl::Span< const IntegerValue > coefficients, std::function< void()> feasible_solution_observer, Model *model)
absl::Span< const double > coefficients
void MinimizeCoreWithPropagation(TimeLimit *limit, SatSolver *solver, std::vector< Literal > *core)
void FilterAssignedLiteral(const VariablesAssignment &assignment, std::vector< Literal > *core)
A core cannot be all true.
void MinimizeCoreWithSearch(TimeLimit *limit, SatSolver *solver, std::vector< Literal > *core)
void PresolveBooleanLinearExpression(std::vector< Literal > *literals, std::vector< Coefficient > *coefficients, Coefficient *offset)
bool ProbeLiteral(Literal assumption, SatSolver *solver)
SatSolver::Status MinimizeIntegerVariableWithLinearScanAndLazyEncoding(IntegerVariable objective_var, const std::function< void()> &feasible_solution_observer, Model *model)
void RestrictObjectiveDomainWithBinarySearch(IntegerVariable objective_var, const std::function< void()> &feasible_solution_observer, Model *model)
In SWIG mode, we don't want anything besides these top-level includes.