 |
OR-Tools
8.1
|
Go to the documentation of this file.
134 #ifndef OR_TOOLS_LINEAR_SOLVER_LINEAR_SOLVER_H_
135 #define OR_TOOLS_LINEAR_SOLVER_LINEAR_SOLVER_H_
137 #include <functional>
145 #include "absl/container/flat_hash_map.h"
146 #include "absl/status/status.h"
147 #include "absl/strings/match.h"
148 #include "absl/strings/str_format.h"
149 #include "absl/types/optional.h"
274 const std::string& solver_id);
279 const std::string&
Name()
const {
285 return problem_type_;
302 const std::vector<MPVariable*>&
variables()
const {
return variables_; }
319 const std::string&
name);
344 void MakeVarArray(
int nb,
double lb,
double ub,
bool integer,
345 const std::string& name_prefix,
346 std::vector<MPVariable*>* vars);
350 std::vector<MPVariable*>* vars);
354 std::vector<MPVariable*>* vars);
358 std::vector<MPVariable*>* vars);
368 const std::vector<MPConstraint*>&
constraints()
const {
return constraints_; }
378 const std::string& constraint_name)
const;
395 const std::string&
name);
408 const std::string&
name);
454 void Write(
const std::string& file_name);
511 std::string* error_message);
520 const MPModelProto& input_model, std::string* error_message);
595 std::string* model_str)
const;
620 return solver_specific_parameter_string_;
636 void SetHint(std::vector<std::pair<const MPVariable*, double> > hint);
662 const std::vector<MPSolver::BasisStatus>& variable_statuses,
663 const std::vector<MPSolver::BasisStatus>& constraint_statuses);
670 static double infinity() {
return std::numeric_limits<double>::infinity(); }
688 absl::Duration
TimeLimit()
const {
return time_limit_; }
695 return absl::Now() - construction_time_;
780 return time_limit_ == absl::InfiniteDuration()
782 : absl::ToInt64Milliseconds(time_limit_);
786 ? absl::InfiniteDuration()
787 : absl::Milliseconds(time_limit_milliseconds));
790 return static_cast<double>(
time_limit()) / 1000.0;
823 int ComputeMaxConstraintSize(
int min_constraint_index,
824 int max_constraint_index)
const;
827 bool HasInfeasibleConstraints()
const;
830 bool HasIntegerVariables()
const;
833 void GenerateVariableNameIndex()
const;
836 void GenerateConstraintNameIndex()
const;
840 static bool GurobiIsCorrectlyInstalled();
843 const std::string name_;
849 std::unique_ptr<MPSolverInterface> interface_;
852 std::vector<MPVariable*> variables_;
854 mutable absl::optional<absl::flat_hash_map<std::string, int> >
855 variable_name_to_index_;
857 std::vector<bool> variable_is_extracted_;
860 std::vector<MPConstraint*> constraints_;
862 mutable absl::optional<absl::flat_hash_map<std::string, int> >
863 constraint_name_to_index_;
865 std::vector<bool> constraint_is_extracted_;
877 std::vector<std::pair<const MPVariable*, double> > solution_hint_;
879 absl::Duration time_limit_ = absl::InfiniteDuration();
881 const absl::Time construction_time_;
884 int num_threads_ = 1;
887 std::string solver_specific_parameter_string_;
890 const MPModelProto& input_model,
bool clear_names,
891 bool check_model_validity, std::string* error_message);
897 return SolverTypeIsMip(
static_cast<MPModelRequest::SolverType
>(solver_type));
906 return os <<
ToString(optimization_problem_type);
911 return os << ProtoEnumToString<MPSolverResponseStatus>(
921 return std::string(
ToString(solver_type));
953 const absl::flat_hash_map<const MPVariable*, double>&
terms()
const {
954 return coefficients_;
961 double offset()
const {
return offset_; }
1007 double Value()
const;
1039 : interface_(interface_in), coefficients_(1),
offset_(0.0) {}
1044 absl::flat_hash_map<const MPVariable*, double> coefficients_;
1055 const std::string&
name()
const {
return name_; }
1076 double lb()
const {
return lb_; }
1079 double ub()
const {
return ub_; }
1152 solution_value_(0.0),
1154 interface_(interface_in) {}
1164 const std::string name_;
1165 double solution_value_;
1166 double reduced_cost_;
1167 int branching_priority_ = 0;
1180 const std::string&
name()
const {
return name_; }
1204 const absl::flat_hash_map<const MPVariable*, double>&
terms()
const {
1205 return coefficients_;
1209 double lb()
const {
return lb_; }
1212 double ub()
const {
return ub_; }
1294 indicator_variable_(nullptr),
1296 interface_(interface_in) {}
1303 bool ContainsNewVariables();
1306 absl::flat_hash_map<const MPVariable*, double> coefficients_;
1317 const std::string name_;
1327 bool indicator_value_;
1484 double relative_mip_gap_value_;
1485 double primal_tolerance_value_;
1486 double dual_tolerance_value_;
1487 int presolve_value_;
1489 int lp_algorithm_value_;
1490 int incrementality_value_;
1495 bool lp_algorithm_is_default_;
1552 const MPModelRequest& request) {
1553 return absl::nullopt;
1558 virtual void Write(
const std::string& filename);
1582 LOG(
ERROR) <<
"Solver doesn't support indicator constraints.";
1592 double new_value,
double old_value) = 0;
1655 return solver_->variable_is_extracted_[var_index];
1658 solver_->variable_is_extracted_[var_index] = extracted;
1661 return solver_->constraint_is_extracted_[ct_index];
1664 solver_->constraint_is_extracted_[ct_index] = extracted;
1690 const std::vector<MPSolver::BasisStatus>& variable_statuses,
1691 const std::vector<MPSolver::BasisStatus>& constraint_statuses) {
1692 LOG(
FATAL) <<
"Not supported by this solver.";
1702 LOG(
FATAL) <<
"Callbacks not supported for this solver.";
1808 #endif // OR_TOOLS_LINEAR_SOLVER_LINEAR_SOLVER_H_
virtual void ExtractObjective()=0
void SetDoubleParamToUnsupportedValue(MPSolverParameters::DoubleParam param, double value)
void SuppressOutput()
Suppresses solver logging.
MPVariable * MakeIntVar(double lb, double ub, const std::string &name)
Creates an integer variable.
bool SolverTypeIsMip(MPModelRequest::SolverType solver_type)
SharedResponseManager * response
void SetLB(double lb)
Sets the lower bound.
MPSolver::OptimizationProblemType problem_type
static const int kDefaultIntegerParamValue
LinearExpr models a quantity that is linear in the decision variables (MPVariable) of an optimization...
bool ExportModelAsLpFormat(bool obfuscate, std::string *model_str) const
Shortcuts to the homonymous MPModelProtoExporter methods, via exporting to a MPModelProto with Export...
@ CBC_MIXED_INTEGER_PROGRAMMING
void SetBounds(double lb, double ub)
Sets both the lower and upper bounds.
virtual void SetParameters(const MPSolverParameters ¶m)=0
double BestBound() const
Returns the best objective bound.
double Value() const
Returns the objective value of the best solution found so far.
void SetInteger(bool integer)
Sets the integrality requirement of the variable.
virtual MPSolver::BasisStatus column_status(int variable_index) const =0
MPSolver::BasisStatus basis_status() const
Advanced usage: returns the basis status of the constraint.
friend class XpressInterface
@ GLOP_LINEAR_PROGRAMMING
int NumVariables() const
Returns the number of variables.
virtual void AddRowConstraint(MPConstraint *const ct)=0
virtual void SetObjectiveOffset(double value)=0
bool SupportsCallbacks() const
virtual void SetScalingMode(int value)=0
MPSolverInterface(MPSolver *const solver)
friend class GLPKInterface
@ XPRESS_LINEAR_PROGRAMMING
void set_dual_value(double dual_value)
@ DUAL_TOLERANCE
Advanced usage: tolerance for dual feasibility of basic solutions.
virtual OptimizationProblemType ProblemType() const
Returns the optimization problem type set at construction.
ScalingValues
Advanced usage: Scaling options.
void set_solution_value(double value)
bool integer() const
Returns the integrality requirement of the variable.
@ LP_ALGORITHM
Algorithm to solve linear programs.
void SetBounds(double lb, double ub)
Sets both the lower and upper bounds.
int index() const
Returns the index of the variable in the MPSolver::variables_.
void SetMinimization()
Sets the optimization direction to minimize.
const MPObjective & Objective() const
Returns the objective object.
@ UNBOUNDED
proven unbounded.
double GetCoefficient(const MPVariable *const var) const
Gets the coefficient of a given variable in the objective.
@ CPLEX_MIXED_INTEGER_PROGRAMMING
virtual void BranchingPriorityChangedForVariable(int var_index)
MPSolverParameters()
The constructor sets all parameters to their default value.
bool ExportModelAsMpsFormat(bool fixed_format, bool obfuscate, std::string *model_str) const
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...
int last_constraint_index_
This mathematical programming (MP) solver class is the main class though which users build and solve ...
friend class XpressInterface
void Reset()
Advanced usage: resets extracted model to solve from scratch.
friend class KnapsackInterface
virtual MPSolver::ResultStatus Solve(const MPSolverParameters ¶m)=0
const absl::flat_hash_map< const MPVariable *, double > & terms() const
Returns a map from variables to their coefficients in the constraint.
virtual bool AddIndicatorConstraint(MPConstraint *const ct)
std::string SolverVersion() const
Returns a string describing the underlying solver and its version.
void AddLinearExpr(const LinearExpr &linear_expr)
Adds linear_expr to the current objective, does not change the direction.
void set_time_limit(int64 time_limit_milliseconds)
MPObjective * MutableObjective()
Returns the mutable objective object.
This file allows you to write natural code (like a mathematical equation) to model optimization probl...
virtual bool IsLP() const =0
const std::string & name() const
Returns the name of the variable.
friend class KnapsackInterface
MPVariable * LookupVariableOrNull(const std::string &var_name) const
Looks up a variable by name, and returns nullptr if it does not exist.
absl::Duration DurationSinceConstruction() const
bool InterruptSolve()
Interrupts the Solve() execution to terminate processing if possible.
double ComputeExactConditionNumber() const
Advanced usage: computes the exact condition number of the current scaled basis: L1norm(B) * L1norm(i...
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
double offset() const
Gets the constant term in the objective.
static const double kDefaultRelativeMipGap
virtual void SetStartingLpBasis(const std::vector< MPSolver::BasisStatus > &variable_statuses, const std::vector< MPSolver::BasisStatus > &constraint_statuses)
absl::Status ClampSolutionWithinBounds()
Resets values of out of bound variables to the corresponding bound and returns an error if any of the...
virtual void ClearObjective()=0
static const int kUnknownIntegerParamValue
bool maximization() const
Is the optimization direction set to maximize?
virtual bool NextSolution()
void InvalidateSolutionSynchronization()
@ MODEL_INVALID
the model is trivially invalid (NaN coefficients, etc).
double unrounded_solution_value() const
Advanced usage: unrounded solution value.
const std::string & Name() const
Returns the name of the model set at construction.
@ GLPK_MIXED_INTEGER_PROGRAMMING
const std::vector< MPVariable * > & variables() const
Returns the array of variables handled by the MPSolver.
virtual bool SupportsCallbacks() const
@ SCALING_OFF
Scaling is off.
@ ABNORMAL
abnormal, i.e., error of some kind.
double ub() const
Returns the upper bound.
virtual absl::optional< MPSolutionResponse > DirectlySolveProto(const MPModelRequest &request)
double solution_value() const
Returns the value of the variable in the current solution.
int index() const
Returns the index of the constraint in the MPSolver::constraints_.
friend class SLMInterface
const MPVariable * indicator_variable() const
const absl::string_view ToString(MPSolver::OptimizationProblemType optimization_problem_type)
static const double kUnknownDoubleParamValue
const std::string & name() const
Returns the name of the constraint.
void SetCoefficient(const MPVariable *const var, double coeff)
Sets the coefficient of the variable in the objective.
ABSL_DECLARE_FLAG(bool, linear_solver_enable_verbose_output)
This class stores parameter settings for LP and MIP solvers.
void SetUB(double ub)
Sets the upper bound.
The class for constraints of a Mathematical Programming (MP) model.
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...
friend class GLPKInterface
std::string AbslUnparseFlag(MPSolver::OptimizationProblemType solver_type)
void set_is_lazy(bool laziness)
Advanced usage: sets the constraint "laziness".
bool constraint_is_extracted(int ct_index) const
MPSolver::BasisStatus basis_status() const
Advanced usage: returns the basis status of the variable in the current solution (only available for ...
ABSL_MUST_USE_RESULT bool NextSolution()
Some solvers (MIP only, not LP) can produce multiple solutions to the problem.
PresolveValues
For each categorical parameter, enumeration of possible values.
virtual bool InterruptSolve()
friend class KnapsackInterface
@ PRESOLVE_ON
Presolve is on.
virtual void SetLpAlgorithm(int value)=0
bool AbslParseFlag(const absl::string_view text, MPSolver::OptimizationProblemType *solver_type, std::string *error)
int last_variable_index() const
friend class GLPKInterface
bool OutputIsEnabled() const
Controls (or queries) the amount of output produced by the underlying solver.
int GetIntegerParam(MPSolverParameters::IntegerParam param) const
Returns the value of an integer parameter.
double objective_value() const
void MakeIntVarArray(int nb, double lb, double ub, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of integer variables.
MPVariable * MakeBoolVar(const std::string &name)
Creates a boolean variable.
@ SCALING_ON
Scaling is on.
virtual void SetPresolveMode(int value)=0
virtual void SetConstraintBounds(int index, double lb, double ub)=0
virtual void Write(const std::string &filename)
void SetOffset(double value)
Sets the constant term in the objective.
void ResetExtractionInformation()
@ INCREMENTALITY_ON
Reuse results from previous solve as much as the underlying solver allows.
static constexpr int64 kUnknownNumberOfIterations
MPSolverResponseStatus LoadModelFromProto(const MPModelProto &input_model, std::string *error_message)
Loads model from protocol buffer.
virtual bool IsContinuous() const =0
virtual bool IsMIP() const =0
const std::vector< MPConstraint * > & constraints() const
Returns the array of constraints handled by the MPSolver.
void SetUnsupportedDoubleParam(MPSolverParameters::DoubleParam param)
@ GLPK_LINEAR_PROGRAMMING
int NumConstraints() const
Returns the number of constraints.
static double infinity()
Infinity.
@ NOT_SOLVED
not been solved yet.
@ BOP_INTEGER_PROGRAMMING
friend class KnapsackInterface
static constexpr int64 kUnknownNumberOfNodes
bool SetSolverSpecificParametersAsString(const std::string ¶meters)
Advanced usage: pass solver specific parameters in text format.
int branching_priority() const
Advanced usage: Certain MIP solvers (e.g.
@ PRESOLVE
Advanced usage: presolve mode.
void set_reduced_cost(double reduced_cost)
@ KNAPSACK_MIXED_INTEGER_PROGRAMMING
friend class CplexInterface
MPVariable * MakeNumVar(double lb, double ub, const std::string &name)
Creates a continuous variable.
static const PresolveValues kDefaultPresolve
virtual std::string ValidFileExtensionForParameterFile() const
virtual void SetVariableBounds(int index, double lb, double ub)=0
absl::Duration TimeLimit() const
void ResetIntegerParam(MPSolverParameters::IntegerParam param)
Sets an integer parameter to its default value (default value defined in MPSolverParameters if it exi...
virtual void SetDualTolerance(double value)=0
void SetTimeLimit(absl::Duration time_limit)
virtual bool SetSolverSpecificParametersAsString(const std::string ¶meters)
void Reset()
Sets all parameters to their default value.
static const IncrementalityValues kDefaultIncrementality
static const double kDefaultDoubleParamValue
MPVariable * MakeVar(double lb, double ub, bool integer, const std::string &name)
Creates a variable with the given bounds, integrality requirement and name.
bool minimization() const
Is the optimization direction set to minimize?
void Write(const std::string &file_name)
Writes the model using the solver internal write function.
virtual void SetCallback(MPCallback *mp_callback)
ResultStatus Solve()
Solves the problem using the default parameter values.
virtual void SetIntegerParamToUnsupportedValue(MPSolverParameters::IntegerParam param, int value)
virtual double ComputeExactConditionNumber() const
virtual bool ReadParameterFile(const std::string &filename)
BasisStatus
Advanced usage: possible basis status values for a variable and the slack variable of a linear constr...
bool CheckSolutionIsSynchronizedAndExists() const
MPConstraint * LookupConstraintOrNull(const std::string &constraint_name) const
Looks up a constraint by name, and returns nullptr if it does not exist.
static const double kDefaultPrimalTolerance
std::ostream & operator<<(std::ostream &out, const Assignment &assignment)
void Clear()
Clears the offset, all variables and coefficients, and the optimization direction.
friend class CplexInterface
void SetDoubleParam(MPSolverParameters::DoubleParam param, double value)
Sets a double parameter to a specific value.
double lb() const
Returns the lower bound.
static void SetGurobiLibraryPath(const std::string &full_library_path)
void SetUB(double ub)
Sets the upper bound.
friend class SLMInterface
void MinimizeLinearExpr(const LinearExpr &linear_expr)
Resets the current objective to minimize linear_expr.
@ SCIP_MIXED_INTEGER_PROGRAMMING
virtual void SetUnsupportedIntegerParam(MPSolverParameters::IntegerParam param)
MPSolver(const std::string &name, OptimizationProblemType problem_type)
Create a solver with the given name and underlying solver backend.
virtual void SetOptimizationDirection(bool maximize)=0
virtual void SetObjectiveCoefficient(const MPVariable *const variable, double coefficient)=0
@ INCREMENTALITY_OFF
Start solve from scratch.
int64 iterations() const
Returns the number of simplex iterations.
double ub() const
Returns the upper bound.
SynchronizationStatus sync_status_
friend class MPVariableSolutionValueTest
An expression of the form:
void SetCallback(MPCallback *mp_callback)
MPConstraint(int index, double lb, double ub, const std::string &name, MPSolverInterface *const interface_in)
void MakeNumVarArray(int nb, double lb, double ub, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of continuous variables.
absl::Status SetNumThreads(int num_threads)
Sets the number of threads to use by the underlying solver.
friend class XpressInterface
virtual void SetRelativeMipGap(double value)=0
@ GUROBI_LINEAR_PROGRAMMING
virtual std::string SolverVersion() const =0
double time_limit_in_secs() const
@ PRIMAL_TOLERANCE
Advanced usage: tolerance for primal feasibility of basic solutions.
IncrementalityValues
Advanced usage: Incrementality options.
ResultStatus
The status of solving the problem.
bool variable_is_extracted(int var_index) const
void SetStartingLpBasis(const std::vector< MPSolver::BasisStatus > &variable_statuses, const std::vector< MPSolver::BasisStatus > &constraint_statuses)
Advanced usage: Incrementality.
std::string GetSolverSpecificParametersAsString() const
bool VerifySolution(double tolerance, bool log_errors) const
Advanced usage: Verifies the correctness of the solution.
MPSolver::ResultStatus result_status() const
static bool LoadGurobiSharedLibrary()
#define DCHECK_GE(val1, val2)
void set_quiet(bool quiet_value)
virtual void SetVariableInteger(int index, bool integer)=0
void SetMIPParameters(const MPSolverParameters ¶m)
double GetDoubleParam(MPSolverParameters::DoubleParam param) const
Returns the value of a double parameter.
void EnableOutput()
Enables solver logging.
static const double kDefaultDualTolerance
MPConstraint * MakeRowConstraint()
Creates a constraint with -infinity and +infinity bounds.
absl::Status LoadSolutionFromProto(const MPSolutionResponse &response, double tolerance=kDefaultPrimalTolerance)
Load a solution encoded in a protocol buffer onto this solver for easy access via the MPSolver interf...
double lb() const
Returns the lower bound.
@ SAT_INTEGER_PROGRAMMING
int64 nodes() const
Returns the number of branch-and-bound nodes evaluated during the solve.
virtual MPSolver::BasisStatus row_status(int constraint_index) const =0
virtual void ExtractNewConstraints()=0
static void SolveWithProto(const MPModelRequest &model_request, MPSolutionResponse *response)
Solves the model encoded by a MPModelRequest protocol buffer and fills the solution encoded as a MPSo...
LpAlgorithmValues
LP algorithm to use.
void set_variable_as_extracted(int var_index, bool extracted)
@ SCALING
Advanced usage: enable or disable matrix scaling.
MPVariable(int index, double lb, double ub, bool integer, const std::string &name, MPSolverInterface *const interface_in)
std::vector< double > ComputeConstraintActivities() const
Advanced usage: compute the "activities" of all constraints, which are the sums of their linear terms...
IntegerParam
Enumeration of parameters that take integer or categorical values.
bool is_lazy() const
Advanced usage: returns true if the constraint is "lazy" (see below).
@ CPLEX_LINEAR_PROGRAMMING
void MakeVarArray(int nb, double lb, double ub, bool integer, const std::string &name_prefix, std::vector< MPVariable * > *vars)
Creates an array of variables.
friend class XpressInterface
void ResetDoubleParam(MPSolverParameters::DoubleParam param)
Sets a double parameter to its default value (default value defined in MPSolverParameters if it exist...
virtual void * underlying_solver()=0
virtual void ExtractNewVariables()=0
bool indicator_value() const
void * underlying_solver()
Advanced usage: returns the underlying solver.
virtual int64 iterations() const =0
friend class SLMInterface
@ RELATIVE_MIP_GAP
Limit for relative MIP gap.
void MaximizeLinearExpr(const LinearExpr &linear_expr)
Resets the current objective to maximize linear_expr.
@ INCREMENTALITY
Advanced usage: incrementality from one solve to the next.
friend class GLPKInterface
double best_objective_bound() const
virtual void SetPrimalTolerance(double value)=0
void SetMaximization()
Sets the optimization direction to maximize.
The class for variables of a Mathematical Programming (MP) model.
void FillSolutionResponseProto(MPSolutionResponse *response) const
Encodes the current solution in a solution response protocol buffer.
OptimizationProblemType
The type of problems (LP or MIP) that will be solved and the underlying solver (GLOP,...
virtual int64 nodes() const =0
void ExportModelToProto(MPModelProto *output_model) const
Exports model to protocol buffer.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
virtual void AddVariable(MPVariable *const var)=0
const absl::flat_hash_map< const MPVariable *, double > & terms() const
Returns a map from variables to their coefficients in the objective.
virtual void ClearConstraint(MPConstraint *const constraint)=0
void SetCommonParameters(const MPSolverParameters ¶m)
void SetCoefficient(const MPVariable *const var, double coeff)
Sets the coefficient of the variable on the constraint.
virtual absl::Status SetNumThreads(int num_threads)
double dual_value() const
Advanced usage: returns the dual value of the constraint in the current solution (only available for ...
void SetOptimizationDirection(bool maximize)
Sets the optimization direction (maximize: true or minimize: false).
static bool ParseSolverType(absl::string_view solver_id, OptimizationProblemType *type)
Parses the name of the solver.
@ INFEASIBLE
proven infeasible.
virtual void SetCoefficient(MPConstraint *const constraint, const MPVariable *const variable, double new_value, double old_value)=0
static MPSolver * CreateSolver(const std::string &solver_id)
Recommended factory method to create a MPSolver instance, especially in non C++ languages.
bool MPSolverResponseStatusIsRpcError(MPSolverResponseStatus status)
friend class SLMInterface
void MakeBoolVarArray(int nb, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of boolean variables.
constexpr double kDefaultPrimalTolerance
DoubleParam
Enumeration of parameters that take continuous values.
@ PRESOLVE_OFF
Presolve is off.
MPSolverResponseStatus LoadModelFromProtoWithUniqueNamesOrDie(const MPModelProto &input_model, std::string *error_message)
Loads model from protocol buffer.
void Clear()
Clears all variables and coefficients. Does not clear the bounds.
void SetLB(double lb)
Sets the lower bound.
virtual bool CheckSolutionExists() const
void Clear()
Clears the objective (including the optimization direction), all variables and constraints.
void SetHint(std::vector< std::pair< const MPVariable *, double > > hint)
Sets a hint for solution.
void SetIntegerParam(MPSolverParameters::IntegerParam param, int value)
Sets a integer parameter to a specific value.
static const int kDummyVariableIndex
bool OwnsVariable(const MPVariable *var) const
bool CheckSolutionIsSynchronized() const
A class to express a linear objective.
void SetBranchingPriority(int priority)
MPSolver::ResultStatus result_status_
void set_constraint_as_extracted(int ct_index, bool extracted)
int GetNumThreads() const
Returns the number of threads to be used during solve.
static bool SupportsProblemType(OptimizationProblemType problem_type)
Whether the given problem type is supported (this will depend on the targets that you linked).
@ XPRESS_MIXED_INTEGER_PROGRAMMING
static OptimizationProblemType ParseSolverTypeOrDie(const std::string &solver_id)
Parses the name of the solver and returns the correct optimization type or dies.
@ GUROBI_MIXED_INTEGER_PROGRAMMING
double reduced_cost() const
Advanced usage: returns the reduced cost of the variable in the current solution (only available for ...
friend class CplexInterface
@ BARRIER
Barrier algorithm.
@ FEASIBLE
feasible, or stopped by limit.
virtual ~MPSolverInterface()
double best_objective_bound_
friend class CplexInterface