134 #ifndef OR_TOOLS_LINEAR_SOLVER_LINEAR_SOLVER_H_ 135 #define OR_TOOLS_LINEAR_SOLVER_LINEAR_SOLVER_H_ 139 #include <functional> 147 #include "absl/base/port.h" 148 #include "absl/container/flat_hash_map.h" 149 #include "absl/flags/parse.h" 150 #include "absl/flags/usage.h" 151 #include "absl/status/status.h" 152 #include "absl/strings/match.h" 153 #include "absl/strings/str_format.h" 154 #include "absl/types/optional.h" 278 const std::string& solver_id);
283 const std::string&
Name()
const {
289 return problem_type_;
306 const std::vector<MPVariable*>&
variables()
const {
return variables_; }
328 const std::string&
name);
353 void MakeVarArray(
int nb,
double lb,
double ub,
bool integer,
354 const std::string& name_prefix,
355 std::vector<MPVariable*>* vars);
359 std::vector<MPVariable*>* vars);
363 std::vector<MPVariable*>* vars);
367 std::vector<MPVariable*>* vars);
377 const std::vector<MPConstraint*>&
constraints()
const {
return constraints_; }
390 const std::string& constraint_name)
const;
407 const std::string&
name);
420 const std::string&
name);
466 void Write(
const std::string& file_name);
525 std::string* error_message);
534 const MPModelProto& input_model, std::string* error_message);
558 std::atomic<bool>* interrupt =
nullptr);
610 double tolerance = std::numeric_limits<double>::infinity());
626 std::string* model_str)
const;
651 return solver_specific_parameter_string_;
667 void SetHint(std::vector<std::pair<const MPVariable*, double> > hint);
693 const std::vector<MPSolver::BasisStatus>& variable_statuses,
694 const std::vector<MPSolver::BasisStatus>& constraint_statuses);
701 static double infinity() {
return std::numeric_limits<double>::infinity(); }
719 absl::Duration
TimeLimit()
const {
return time_limit_; }
726 return absl::Now() - construction_time_;
737 int64_t
nodes()
const;
817 return time_limit_ == absl::InfiniteDuration()
819 : absl::ToInt64Milliseconds(time_limit_);
823 ? absl::InfiniteDuration()
824 : absl::Milliseconds(time_limit_milliseconds));
827 return static_cast<double>(
time_limit()) / 1000.0;
856 int ComputeMaxConstraintSize(
int min_constraint_index,
857 int max_constraint_index)
const;
860 bool HasInfeasibleConstraints()
const;
863 bool HasIntegerVariables()
const;
866 void GenerateVariableNameIndex()
const;
869 void GenerateConstraintNameIndex()
const;
872 const std::string name_;
878 std::unique_ptr<MPSolverInterface> interface_;
881 std::vector<MPVariable*> variables_;
883 mutable absl::optional<absl::flat_hash_map<std::string, int> >
884 variable_name_to_index_;
886 std::vector<bool> variable_is_extracted_;
889 std::vector<MPConstraint*> constraints_;
891 mutable absl::optional<absl::flat_hash_map<std::string, int> >
892 constraint_name_to_index_;
894 std::vector<bool> constraint_is_extracted_;
906 std::vector<std::pair<const MPVariable*, double> > solution_hint_;
908 absl::Duration time_limit_ = absl::InfiniteDuration();
910 const absl::Time construction_time_;
913 int num_threads_ = 1;
916 std::string solver_specific_parameter_string_;
918 static absl::Mutex global_count_mutex_;
920 static int64_t global_num_variables_ ABSL_GUARDED_BY(global_count_mutex_);
921 static int64_t global_num_constraints_ ABSL_GUARDED_BY(global_count_mutex_);
926 bool check_model_validity, std::string* error_message);
932 return SolverTypeIsMip(static_cast<MPModelRequest::SolverType>(solver_type));
941 return os <<
ToString(optimization_problem_type);
946 return os << ProtoEnumToString<MPSolverResponseStatus>(
947 static_cast<MPSolverResponseStatus>(status));
956 return std::string(
ToString(solver_type));
988 const absl::flat_hash_map<const MPVariable*, double>&
terms()
const {
989 return coefficients_;
996 double offset()
const {
return offset_; }
1042 double Value()
const;
1074 : interface_(interface_in), coefficients_(1),
offset_(0.0) {}
1079 absl::flat_hash_map<const MPVariable*, double> coefficients_;
1090 const std::string&
name()
const {
return name_; }
1111 double lb()
const {
return lb_; }
1114 double ub()
const {
return ub_; }
1187 solution_value_(0.0),
1189 interface_(interface_in) {}
1199 const std::string name_;
1200 double solution_value_;
1201 double reduced_cost_;
1202 int branching_priority_ = 0;
1215 const std::string&
name()
const {
return name_; }
1239 const absl::flat_hash_map<const MPVariable*, double>&
terms()
const {
1240 return coefficients_;
1244 double lb()
const {
return lb_; }
1247 double ub()
const {
return ub_; }
1329 indicator_variable_(nullptr),
1331 interface_(interface_in) {}
1338 bool ContainsNewVariables();
1341 absl::flat_hash_map<const MPVariable*, double> coefficients_;
1352 const std::string name_;
1362 bool indicator_value_;
1519 double relative_mip_gap_value_;
1520 double primal_tolerance_value_;
1521 double dual_tolerance_value_;
1522 int presolve_value_;
1524 int lp_algorithm_value_;
1525 int incrementality_value_;
1530 bool lp_algorithm_is_default_;
1593 std::atomic<bool>* interrupt) {
1594 return absl::nullopt;
1599 virtual void Write(
const std::string& filename);
1603 virtual void Reset() = 0;
1623 LOG(
ERROR) <<
"Solver doesn't support indicator constraints.";
1633 double new_value,
double old_value) = 0;
1655 virtual int64_t
nodes()
const = 0;
1688 virtual bool IsLP()
const = 0;
1690 virtual bool IsMIP()
const = 0;
1696 return solver_->variable_is_extracted_[var_index];
1699 solver_->variable_is_extracted_[var_index] = extracted;
1702 return solver_->constraint_is_extracted_[ct_index];
1705 solver_->constraint_is_extracted_[ct_index] = extracted;
1731 const std::vector<MPSolver::BasisStatus>& variable_statuses,
1732 const std::vector<MPSolver::BasisStatus>& constraint_statuses) {
1733 LOG(
FATAL) <<
"Not supported by this solver.";
1743 LOG(
FATAL) <<
"Callbacks not supported for this solver.";
1838 #endif // OR_TOOLS_LINEAR_SOLVER_LINEAR_SOLVER_H_ ResultStatus
The status of solving the problem.
bool ExportModelAsMpsFormat(bool fixed_format, bool obfuscate, std::string *model_str) const
const absl::flat_hash_map< const MPVariable *, double > & terms() const
Returns a map from variables to their coefficients in the constraint.
virtual absl::optional< MPSolutionResponse > DirectlySolveProto(const MPModelRequest &request, std::atomic< bool > *interrupt)
static const IncrementalityValues kDefaultIncrementality
virtual OptimizationProblemType ProblemType() const
Returns the optimization problem type set at construction.
MPVariable * LookupVariableOrNull(const std::string &var_name) const
Looks up a variable by name, and returns nullptr if it does not exist.
void set_variable_as_extracted(int var_index, bool extracted)
friend class SLMInterface
bool InterruptSolve()
Interrupts the Solve() execution to terminate processing if possible.
static const double kDefaultPrimalTolerance
MPVariable * MakeIntVar(double lb, double ub, const std::string &name)
Creates an integer variable.
Advanced usage: incrementality from one solve to the next.
virtual absl::Status SetNumThreads(int num_threads)
static MPSolver * CreateSolver(const std::string &solver_id)
Recommended factory method to create a MPSolver instance, especially in non C++ languages.
void SetDoubleParam(MPSolverParameters::DoubleParam param, double value)
Sets a double parameter to a specific value.
virtual void SetLpAlgorithm(int value)=0
static constexpr SolverType GUROBI_LINEAR_PROGRAMMING
ScalingValues
Advanced usage: Scaling options.
double Value() const
Returns the objective value of the best solution found so far.
virtual void SetOptimizationDirection(bool maximize)=0
virtual void ExtractNewVariables()=0
double best_objective_bound_
virtual void SetPresolveMode(int value)=0
const std::vector< MPConstraint * > & constraints() const
Returns the array of constraints handled by the MPSolver.
friend class SLMInterface
MPSolver::ResultStatus result_status() const
void set_constraint_as_extracted(int ct_index, bool extracted)
static OptimizationProblemType ParseSolverTypeOrDie(const std::string &solver_id)
Parses the name of the solver and returns the correct optimization type or dies.
void Clear()
Clears the objective (including the optimization direction), all variables and constraints.
void SetOffset(double value)
Sets the constant term in the objective.
void SetStartingLpBasis(const std::vector< MPSolver::BasisStatus > &variable_statuses, const std::vector< MPSolver::BasisStatus > &constraint_statuses)
Advanced usage: Incrementality.
SynchronizationStatus sync_status_
virtual double ComputeExactConditionNumber() const
double best_objective_bound() const
const std::string & name() const
Returns the name of the constraint.
const MPObjective & Objective() const
Returns the objective object.
MPSolverParameters()
The constructor sets all parameters to their default value.
double ub() const
Returns the upper bound.
static double infinity()
Infinity.
virtual bool AddIndicatorConstraint(MPConstraint *const ct)
virtual void ClearConstraint(MPConstraint *const constraint)=0
virtual void SetCallback(MPCallback *mp_callback)
void SetCoefficient(const MPVariable *const var, double coeff)
Sets the coefficient of the variable in the objective.
virtual bool SupportsCallbacks() const
void ResetDoubleParam(MPSolverParameters::DoubleParam param)
Sets a double parameter to its default value (default value defined in MPSolverParameters if it exist...
void Clear()
Clears all variables and coefficients. Does not clear the bounds.
void SetDoubleParamToUnsupportedValue(MPSolverParameters::DoubleParam param, double value)
double BestBound() const
Returns the best objective bound.
int NumVariables() const
Returns the number of variables.
static bool SupportsProblemType(OptimizationProblemType problem_type)
Whether the given problem type is supported (this will depend on the targets that you linked).
const absl::string_view ToString(MPSolver::OptimizationProblemType optimization_problem_type)
bool integer() const
Returns the integrality requirement of the variable.
bool minimization() const
Is the optimization direction set to minimize?
OptimizationProblemType
The type of problems (LP or MIP) that will be solved and the underlying solver (GLOP,...
void SetMinimization()
Sets the optimization direction to minimize.
void SetBounds(double lb, double ub)
Sets both the lower and upper bounds.
A class to express a linear objective.
static const double kDefaultRelativeMipGap
static const double kUnknownDoubleParamValue
friend class KnapsackInterface
Advanced usage: presolve mode.
BasisStatus
Advanced usage: possible basis status values for a variable and the slack variable of a linear constr...
const MPVariable * indicator_variable() const
ABSL_DECLARE_FLAG(bool, linear_solver_enable_verbose_output)
IntegerParam
Enumeration of parameters that take integer or categorical values.
virtual void Write(const std::string &filename)
friend class MPVariableSolutionValueTest
MPSolver::ResultStatus result_status_
virtual bool IsContinuous() const =0
MPObjective * MutableObjective()
Returns the mutable objective object.
void Reset()
Advanced usage: resets extracted model to solve from scratch.
virtual int64_t nodes() const =0
static int64_t global_num_constraints()
double GetCoefficient(const MPVariable *const var) const
Gets the coefficient of a given variable on the constraint (which is 0 if the variable does not appea...
void set_dual_value(double dual_value)
MPSolverInterface(MPSolver *const solver)
MPVariable * MakeBoolVar(const std::string &name)
Creates a boolean variable.
void ResetIntegerParam(MPSolverParameters::IntegerParam param)
Sets an integer parameter to its default value (default value defined in MPSolverParameters if it exi...
virtual int64_t iterations() const =0
int GetIntegerParam(MPSolverParameters::IntegerParam param) const
Returns the value of an integer parameter.
virtual void SetObjectiveCoefficient(const MPVariable *const variable, double coefficient)=0
virtual void SetRelativeMipGap(double value)=0
friend class GLPKInterface
void SetIntegerParam(MPSolverParameters::IntegerParam param, int value)
Sets a integer parameter to a specific value.
MPConstraint(int index, double lb, double ub, const std::string &name, MPSolverInterface *const interface_in)
absl::Status ClampSolutionWithinBounds()
Resets values of out of bound variables to the corresponding bound and returns an error if any of the...
void MaximizeLinearExpr(const LinearExpr &linear_expr)
Resets the current objective to maximize linear_expr.
virtual void ExtractNewConstraints()=0
void set_solution_value(double value)
void SetHint(std::vector< std::pair< const MPVariable *, double > > hint)
Sets a hint for solution.
virtual bool IsLP() const =0
MPSolver(const std::string &name, OptimizationProblemType problem_type)
Create a solver with the given name and underlying solver backend.
The class for variables of a Mathematical Programming (MP) model.
friend class CplexInterface
int64_t wall_time() const
MPSolver::BasisStatus basis_status() const
Advanced usage: returns the basis status of the variable in the current solution (only available for ...
bool SupportsCallbacks() const
bool SetSolverSpecificParametersAsString(const std::string ¶meters)
Advanced usage: pass solver specific parameters in text format.
void MakeIntVarArray(int nb, double lb, double ub, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of integer variables.
virtual void ExtractObjective()=0
Limit for relative MIP gap.
void OptimizeLinearExpr(const LinearExpr &linear_expr, bool is_maximization)
Resets the current objective to take the value of linear_expr, and sets the objective direction to ma...
virtual void SetObjectiveOffset(double value)=0
the model is trivially invalid (NaN coefficients, etc).
friend class XpressInterface
DoubleParam
Enumeration of parameters that take continuous values.
virtual void SetDualTolerance(double value)=0
static int64_t global_num_variables()
virtual void SetScalingMode(int value)=0
virtual bool NextSolution()
static const int kDummyVariableIndex
friend class GLPKInterface
MPVariable(int index, double lb, double ub, bool integer, const std::string &name, MPSolverInterface *const interface_in)
double ub() const
Returns the upper bound.
void SetBounds(double lb, double ub)
Sets both the lower and upper bounds.
absl::Status SetNumThreads(int num_threads)
Sets the number of threads to use by the underlying solver.
MPConstraint * LookupConstraintOrNull(const std::string &constraint_name) const
Looks up a constraint by name, and returns nullptr if it does not exist.
virtual void SetIntegerParamToUnsupportedValue(MPSolverParameters::IntegerParam param, int value)
void set_quiet(bool quiet_value)
static const int kDefaultIntegerParamValue
std::vector< double > ComputeConstraintActivities() const
Advanced usage: compute the "activities" of all constraints, which are the sums of their linear terms...
double ComputeExactConditionNumber() const
Advanced usage: computes the exact condition number of the current scaled basis: L1norm(B) * L1norm(i...
friend class SLMInterface
bool VerifySolution(double tolerance, bool log_errors) const
Advanced usage: Verifies the correctness of the solution.
int64_t iterations() const
Returns the number of simplex iterations.
MPVariable * MakeVar(double lb, double ub, bool integer, const std::string &name)
Creates a variable with the given bounds, integrality requirement and name.
void MakeVarArray(int nb, double lb, double ub, bool integer, const std::string &name_prefix, std::vector< MPVariable * > *vars)
Creates an array of variables.
bool indicator_value() const
virtual void SetConstraintBounds(int index, double lb, double ub)=0
bool SolverTypeIsMip(MPModelRequest::SolverType solver_type)
double objective_value() const
void Write(const std::string &file_name)
Writes the model using the solver internal write function.
void SetCommonParameters(const MPSolverParameters ¶m)
int64_t time_limit() const
static constexpr int64_t kUnknownNumberOfIterations
virtual std::string SolverVersion() const =0
virtual void SetUnsupportedIntegerParam(MPSolverParameters::IntegerParam param)
const std::string & name() const
Returns the name of the variable.
virtual MPSolver::ResultStatus Solve(const MPSolverParameters ¶m)=0
void SuppressOutput()
Suppresses solver logging.
void Reset()
Sets all parameters to their default value.
friend class GLPKInterface
LpAlgorithmValues
LP algorithm to use.
double solution_value() const
Returns the value of the variable in the current solution.
friend class XpressInterface
virtual void SetVariableBounds(int index, double lb, double ub)=0
void SetLB(double lb)
Sets the lower bound.
The class for constraints of a Mathematical Programming (MP) model.
static const PresolveValues kDefaultPresolve
feasible, or stopped by limit.
static const double kDefaultDualTolerance
#define DCHECK_GE(val1, val2)
friend class KnapsackInterface
double GetCoefficient(const MPVariable *const var) const
Gets the coefficient of a given variable in the objective.
void SetMIPParameters(const MPSolverParameters ¶m)
SharedResponseManager * response
virtual ~MPSolverInterface()
static bool SolverTypeSupportsInterruption(const MPModelRequest::SolverType solver)
void EnableOutput()
Enables solver logging.
bool constraint_is_extracted(int ct_index) const
void InvalidateSolutionSynchronization()
Advanced usage: tolerance for primal feasibility of basic solutions.
virtual void SetCoefficient(MPConstraint *const constraint, const MPVariable *const variable, double new_value, double old_value)=0
friend class KnapsackInterface
absl::Duration DurationSinceConstruction() const
friend class SLMInterface
void SetLB(double lb)
Sets the lower bound.
virtual bool IsMIP() const =0
friend class KnapsackInterface
static const double kDefaultDoubleParamValue
This file allows you to write natural code (like a mathematical equation) to model optimization probl...
MPVariable * MakeNumVar(double lb, double ub, const std::string &name)
Creates a continuous variable.
double dual_value() const
Advanced usage: returns the dual value of the constraint in the current solution (only available for ...
int index() const
Returns the index of the constraint in the MPSolver::constraints_.
bool OutputIsEnabled() const
Controls (or queries) the amount of output produced by the underlying solver.
void MinimizeLinearExpr(const LinearExpr &linear_expr)
Resets the current objective to minimize linear_expr.
virtual void BranchingPriorityChangedForVariable(int var_index)
int NumConstraints() const
Returns the number of constraints.
friend class GLPKInterface
int last_constraint_index_
void MakeNumVarArray(int nb, double lb, double ub, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of continuous variables.
int index() const
Returns the index of the variable in the MPSolver::variables_.
friend class CplexInterface
Advanced usage: enable or disable matrix scaling.
bool CheckSolutionIsSynchronized() const
void SetCallback(MPCallback *mp_callback)
void SetBranchingPriority(int priority)
double unrounded_solution_value() const
Advanced usage: unrounded solution value.
MPSolver::BasisStatus basis_status() const
Advanced usage: returns the basis status of the constraint.
bool AbslParseFlag(const absl::string_view text, MPSolver::OptimizationProblemType *solver_type, std::string *error)
std::string GetSolverSpecificParametersAsString() const
double GetDoubleParam(MPSolverParameters::DoubleParam param) const
Returns the value of a double parameter.
virtual void AddRowConstraint(MPConstraint *const ct)=0
static constexpr int64_t kUnknownNumberOfNodes
std::string AbslUnparseFlag(MPSolver::OptimizationProblemType solver_type)
Advanced usage: tolerance for dual feasibility of basic solutions.
absl::Duration TimeLimit() const
void AddLinearExpr(const LinearExpr &linear_expr)
Adds linear_expr to the current objective, does not change the direction.
MPSolverResponseStatus LoadModelFromProto(const MPModelProto &input_model, std::string *error_message)
Loads model from protocol buffer.
bool CheckSolutionIsSynchronizedAndExists() const
bool maximization() const
Is the optimization direction set to maximize?
double lb() const
Returns the lower bound.
void SetTimeLimit(absl::Duration time_limit)
MPVariable * variable(int index) const
Returns the variable at position index.
virtual void ClearObjective()=0
void SetCoefficient(const MPVariable *const var, double coeff)
Sets the coefficient of the variable on the constraint.
int64_t nodes() const
Returns the number of branch-and-bound nodes evaluated during the solve.
const absl::flat_hash_map< const MPVariable *, double > & terms() const
Returns a map from variables to their coefficients in the objective.
double lb() const
Returns the lower bound.
Reuse results from previous solve as much as the underlying solver allows.
ResultStatus Solve()
Solves the problem using the default parameter values.
const std::vector< MPVariable * > & variables() const
Returns the array of variables handled by the MPSolver.
This mathematical programming (MP) solver class is the main class though which users build and solve ...
IncrementalityValues
Advanced usage: Incrementality options.
LinearExpr models a quantity that is linear in the decision variables (MPVariable) of an optimization...
bool OwnsVariable(const MPVariable *var) const
friend class XpressInterface
virtual void SetVariableInteger(int index, bool integer)=0
Collection of objects used to extend the Constraint Solver library.
std::ostream & operator<<(std::ostream &out, const Assignment &assignment)
void MakeBoolVarArray(int nb, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of boolean variables.
static const int kUnknownIntegerParamValue
abnormal, i.e., error of some kind.
Start solve from scratch.
void SetUB(double ub)
Sets the upper bound.
void SetUB(double ub)
Sets the upper bound.
MPConstraint * MakeRowConstraint()
Creates a constraint with -infinity and +infinity bounds.
static constexpr SolverType SAT_INTEGER_PROGRAMMING
MPSolver::OptimizationProblemType problem_type
virtual bool CheckSolutionExists() const
bool is_lazy() const
Advanced usage: returns true if the constraint is "lazy" (see below).
std::string SolverVersion() const
Returns a string describing the underlying solver and its version.
const std::string & Name() const
Returns the name of the model set at construction.
This class stores parameter settings for LP and MIP solvers.
virtual void * underlying_solver()=0
void Clear()
Clears the offset, all variables and coefficients, and the optimization direction.
absl::Status LoadSolutionFromProto(const MPSolutionResponse &response, double tolerance=std::numeric_limits< double >::infinity())
Load a solution encoded in a protocol buffer onto this solver for easy access via the MPSolver interf...
MPSolverResponseStatus LoadModelFromProtoWithUniqueNamesOrDie(const MPModelProto &input_model, std::string *error_message)
Loads model from protocol buffer.
bool ExportModelAsLpFormat(bool obfuscate, std::string *model_str) const
Shortcuts to the homonymous MPModelProtoExporter methods, via exporting to a MPModelProto with Export...
virtual MPSolver::BasisStatus column_status(int variable_index) const =0
friend class CplexInterface
bool MPSolverResponseStatusIsRpcError(MPSolverResponseStatus status)
Algorithm to solve linear programs.
PresolveValues
For each categorical parameter, enumeration of possible values.
An expression of the form:
virtual void SetPrimalTolerance(double value)=0
void ExportModelToProto(MPModelProto *output_model) const
Exports model to protocol buffer.
static constexpr SolverType GLOP_LINEAR_PROGRAMMING
void ResetExtractionInformation()
void * underlying_solver()
Advanced usage: returns the underlying solver.
virtual bool SetSolverSpecificParametersAsString(const std::string ¶meters)
void SetInteger(bool integer)
Sets the integrality requirement of the variable.
friend class XpressInterface
int last_variable_index() const
int GetNumThreads() const
Returns the number of threads to be used during solve.
void SetUnsupportedDoubleParam(MPSolverParameters::DoubleParam param)
virtual bool InterruptSolve()
MPConstraint * constraint(int index) const
Returns the constraint at the given index.
constexpr double kDefaultPrimalTolerance
void set_time_limit(int64_t time_limit_milliseconds)
static void SolveWithProto(const MPModelRequest &model_request, MPSolutionResponse *response, std::atomic< bool > *interrupt=nullptr)
Solves the model encoded by a MPModelRequest protocol buffer and fills the solution encoded as a MPSo...
friend class CplexInterface
void FillSolutionResponseProto(MPSolutionResponse *response) const
Encodes the current solution in a solution response protocol buffer.
virtual void AddVariable(MPVariable *const var)=0
virtual MPSolver::BasisStatus row_status(int constraint_index) const =0
virtual void SetStartingLpBasis(const std::vector< MPSolver::BasisStatus > &variable_statuses, const std::vector< MPSolver::BasisStatus > &constraint_statuses)
double offset() const
Gets the constant term in the objective.
double reduced_cost() const
Advanced usage: returns the reduced cost of the variable in the current solution (only available for ...
void set_reduced_cost(double reduced_cost)
static constexpr SolverType GUROBI_MIXED_INTEGER_PROGRAMMING
double time_limit_in_secs() const
void SetOptimizationDirection(bool maximize)
Sets the optimization direction (maximize: true or minimize: false).
MPModelRequest_SolverType
bool variable_is_extracted(int var_index) const
ABSL_MUST_USE_RESULT bool NextSolution()
Some solvers (MIP only, not LP) can produce multiple solutions to the problem.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
virtual void SetParameters(const MPSolverParameters ¶m)=0
static bool ParseSolverType(absl::string_view solver_id, OptimizationProblemType *type)
Parses the name of the solver.
void SetMaximization()
Sets the optimization direction to maximize.
int branching_priority() const
Advanced usage: Certain MIP solvers (e.g.
void set_is_lazy(bool laziness)
Advanced usage: sets the constraint "laziness".