 |
OR-Tools
8.0
|
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"
272 const std::string& solver_id);
277 const std::string&
Name()
const {
283 return problem_type_;
300 const std::vector<MPVariable*>&
variables()
const {
return variables_; }
317 const std::string&
name);
342 void MakeVarArray(
int nb,
double lb,
double ub,
bool integer,
343 const std::string& name_prefix,
344 std::vector<MPVariable*>* vars);
348 std::vector<MPVariable*>* vars);
352 std::vector<MPVariable*>* vars);
356 std::vector<MPVariable*>* vars);
366 const std::vector<MPConstraint*>&
constraints()
const {
return constraints_; }
376 const std::string& constraint_name)
const;
393 const std::string&
name);
406 const std::string&
name);
452 void Write(
const std::string& file_name);
509 std::string* error_message);
518 const MPModelProto& input_model, std::string* error_message);
593 std::string* model_str)
const;
618 return solver_specific_parameter_string_;
634 void SetHint(std::vector<std::pair<const MPVariable*, double> > hint);
660 const std::vector<MPSolver::BasisStatus>& variable_statuses,
661 const std::vector<MPSolver::BasisStatus>& constraint_statuses);
668 static double infinity() {
return std::numeric_limits<double>::infinity(); }
686 absl::Duration
TimeLimit()
const {
return time_limit_; }
693 return absl::Now() - construction_time_;
778 return time_limit_ == absl::InfiniteDuration()
780 : absl::ToInt64Milliseconds(time_limit_);
784 ? absl::InfiniteDuration()
785 : absl::Milliseconds(time_limit_milliseconds));
788 return static_cast<double>(
time_limit()) / 1000.0;
821 int ComputeMaxConstraintSize(
int min_constraint_index,
822 int max_constraint_index)
const;
825 bool HasInfeasibleConstraints()
const;
828 bool HasIntegerVariables()
const;
831 void GenerateVariableNameIndex()
const;
834 void GenerateConstraintNameIndex()
const;
838 static bool GurobiIsCorrectlyInstalled();
841 const std::string name_;
847 std::unique_ptr<MPSolverInterface> interface_;
850 std::vector<MPVariable*> variables_;
852 mutable absl::optional<absl::flat_hash_map<std::string, int> >
853 variable_name_to_index_;
855 std::vector<bool> variable_is_extracted_;
858 std::vector<MPConstraint*> constraints_;
860 mutable absl::optional<absl::flat_hash_map<std::string, int> >
861 constraint_name_to_index_;
863 std::vector<bool> constraint_is_extracted_;
875 std::vector<std::pair<const MPVariable*, double> > solution_hint_;
877 absl::Duration time_limit_ = absl::InfiniteDuration();
879 const absl::Time construction_time_;
882 int num_threads_ = 1;
885 std::string solver_specific_parameter_string_;
888 const MPModelProto& input_model,
bool clear_names,
889 bool check_model_validity, std::string* error_message);
895 return SolverTypeIsMip(
static_cast<MPModelRequest::SolverType
>(solver_type));
904 return os <<
ToString(optimization_problem_type);
909 return os << ProtoEnumToString<MPSolverResponseStatus>(
919 return std::string(
ToString(solver_type));
951 const absl::flat_hash_map<const MPVariable*, double>&
terms()
const {
952 return coefficients_;
959 double offset()
const {
return offset_; }
1005 double Value()
const;
1037 : interface_(interface_in), coefficients_(1),
offset_(0.0) {}
1042 absl::flat_hash_map<const MPVariable*, double> coefficients_;
1053 const std::string&
name()
const {
return name_; }
1074 double lb()
const {
return lb_; }
1077 double ub()
const {
return ub_; }
1150 solution_value_(0.0),
1152 interface_(interface_in) {}
1162 const std::string name_;
1163 double solution_value_;
1164 double reduced_cost_;
1165 int branching_priority_ = 0;
1178 const std::string&
name()
const {
return name_; }
1202 const absl::flat_hash_map<const MPVariable*, double>&
terms()
const {
1203 return coefficients_;
1207 double lb()
const {
return lb_; }
1210 double ub()
const {
return ub_; }
1292 indicator_variable_(nullptr),
1294 interface_(interface_in) {}
1301 bool ContainsNewVariables();
1304 absl::flat_hash_map<const MPVariable*, double> coefficients_;
1315 const std::string name_;
1325 bool indicator_value_;
1482 double relative_mip_gap_value_;
1483 double primal_tolerance_value_;
1484 double dual_tolerance_value_;
1485 int presolve_value_;
1487 int lp_algorithm_value_;
1488 int incrementality_value_;
1493 bool lp_algorithm_is_default_;
1550 const MPModelRequest& request) {
1551 return absl::nullopt;
1556 virtual void Write(
const std::string& filename);
1580 LOG(ERROR) <<
"Solver doesn't support indicator constraints.";
1590 double new_value,
double old_value) = 0;
1659 return solver_->variable_is_extracted_[var_index];
1662 solver_->variable_is_extracted_[var_index] = extracted;
1665 return solver_->constraint_is_extracted_[ct_index];
1668 solver_->constraint_is_extracted_[ct_index] = extracted;
1694 const std::vector<MPSolver::BasisStatus>& variable_statuses,
1695 const std::vector<MPSolver::BasisStatus>& constraint_statuses) {
1696 LOG(FATAL) <<
"Not supported by this solver.";
1706 LOG(FATAL) <<
"Callbacks not supported for this solver.";
1809 #endif // OR_TOOLS_LINEAR_SOLVER_LINEAR_SOLVER_H_
@ XPRESS_LINEAR_PROGRAMMING
int NumConstraints() const
Returns the number of constraints.
bool variable_is_extracted(int var_index) const
void SetMaximization()
Sets the optimization direction to maximize.
@ GLOP_LINEAR_PROGRAMMING
static MPSolver * CreateSolver(const std::string &solver_id)
Recommended factory method to create a MPSolver instance, especially in non C++ languages.
int GetIntegerParam(MPSolverParameters::IntegerParam param) const
Returns the value of an integer parameter.
@ LP_ALGORITHM
Algorithm to solve linear programs.
void SetCoefficient(const MPVariable *const var, double coeff)
Sets the coefficient of the variable on the constraint.
MPVariable * MakeBoolVar(const std::string &name)
Creates a boolean variable.
bool SolverTypeIsMip(MPModelRequest::SolverType solver_type)
SharedResponseManager * response
virtual bool IsContinuous() const =0
MPSolver::OptimizationProblemType problem_type
void Reset()
Advanced usage: resets extracted model to solve from scratch.
virtual bool NextSolution()
friend class XpressInterface
virtual ~MPSolverInterface()
The class for variables of a Mathematical Programming (MP) model.
This mathematical programming (MP) solver class is the main class though which users build and solve ...
void ResetDoubleParam(MPSolverParameters::DoubleParam param)
Sets a double parameter to its default value (default value defined in MPSolverParameters if it exist...
friend class KnapsackInterface
MPSolverInterface(MPSolver *const solver)
@ PRESOLVE_OFF
Presolve is off.
bool indicator_value() const
void * underlying_solver()
Advanced usage: returns the underlying solver.
MPSolver::ResultStatus result_status_
@ GLPK_MIXED_INTEGER_PROGRAMMING
friend class KnapsackInterface
@ DUAL_TOLERANCE
Advanced usage: tolerance for dual feasibility of basic solutions.
int index() const
Returns the index of the variable in the MPSolver::variables_.
void Clear()
Clears all variables and coefficients. Does not clear the bounds.
MPVariable * MakeIntVar(double lb, double ub, const std::string &name)
Creates an integer variable.
static const IncrementalityValues kDefaultIncrementality
ABSL_MUST_USE_RESULT bool NextSolution()
Some solvers (MIP only, not LP) can produce multiple solutions to the problem.
virtual void SetVariableBounds(int index, double lb, double ub)=0
void MakeBoolVarArray(int nb, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of boolean variables.
virtual bool CheckSolutionExists() const
void SetCoefficient(const MPVariable *const var, double coeff)
Sets the coefficient of the variable in the objective.
void MakeIntVarArray(int nb, double lb, double ub, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of integer variables.
void MinimizeLinearExpr(const LinearExpr &linear_expr)
Resets the current objective to minimize linear_expr.
bool ExportModelAsMpsFormat(bool fixed_format, bool obfuscate, std::string *model_str) const
bool ExportModelAsLpFormat(bool obfuscate, std::string *model_str) const
Shortcuts to the homonymous MPModelProtoExporter methods, via exporting to a MPModelProto with Export...
void SuppressOutput()
Suppresses solver logging.
friend class CplexInterface
The class for constraints of a Mathematical Programming (MP) model.
friend class XpressInterface
@ FEASIBLE
feasible, or stopped by limit.
virtual void ExtractNewVariables()=0
virtual void SetOptimizationDirection(bool maximize)=0
void SetIntegerParam(MPSolverParameters::IntegerParam param, int value)
Sets a integer parameter to a specific value.
@ SCALING_OFF
Scaling is off.
@ CPLEX_MIXED_INTEGER_PROGRAMMING
MPConstraint * LookupConstraintOrNull(const std::string &constraint_name) const
Looks up a constraint by name, and returns nullptr if it does not exist.
virtual bool IsMIP() const =0
double GetCoefficient(const MPVariable *const var) const
Gets the coefficient of a given variable in the objective.
bool minimization() const
Is the optimization direction set to minimize?
static const double kDefaultRelativeMipGap
double offset() const
Gets the constant term in the objective.
virtual void ClearConstraint(MPConstraint *const constraint)=0
bool InterruptSolve()
Interrupts the Solve() execution to terminate processing if possible.
void SetLB(double lb)
Sets the lower bound.
friend class KnapsackInterface
virtual double ComputeExactConditionNumber() const
void set_variable_as_extracted(int var_index, bool extracted)
static const double kDefaultDualTolerance
void set_time_limit(int64 time_limit_milliseconds)
friend class XpressInterface
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
virtual bool InterruptSolve()
@ SCALING
Advanced usage: enable or disable matrix scaling.
const absl::flat_hash_map< const MPVariable *, double > & terms() const
Returns a map from variables to their coefficients in the objective.
static OptimizationProblemType ParseSolverTypeOrDie(const std::string &solver_id)
Parses the name of the solver and returns the correct optimization type or dies.
static double infinity()
Infinity.
@ GLPK_LINEAR_PROGRAMMING
virtual void * underlying_solver()=0
PresolveValues
For each categorical parameter, enumeration of possible values.
void ExportModelToProto(MPModelProto *output_model) const
Exports model to protocol buffer.
static const int kDummyVariableIndex
virtual bool ReadParameterFile(const std::string &filename)
virtual bool SetSolverSpecificParametersAsString(const std::string ¶meters)
void SetUB(double ub)
Sets the upper bound.
LpAlgorithmValues
LP algorithm to use.
MPSolverResponseStatus LoadModelFromProtoWithUniqueNamesOrDie(const MPModelProto &input_model, std::string *error_message)
Loads model from protocol buffer.
const std::string & name() const
Returns the name of the variable.
static const double kUnknownDoubleParamValue
@ RELATIVE_MIP_GAP
Limit for relative MIP gap.
void SetCallback(MPCallback *mp_callback)
virtual void ExtractNewConstraints()=0
double dual_value() const
Advanced usage: returns the dual value of the constraint in the current solution (only available for ...
This class stores parameter settings for LP and MIP solvers.
double ub() const
Returns the upper bound.
virtual bool IsLP() const =0
const absl::string_view ToString(MPSolver::OptimizationProblemType optimization_problem_type)
An expression of the form:
void SetUnsupportedDoubleParam(MPSolverParameters::DoubleParam param)
bool CheckSolutionIsSynchronized() const
static void SetGurobiLibraryPath(const std::string &full_library_path)
int branching_priority() const
Advanced usage: Certain MIP solvers (e.g.
bool VerifySolution(double tolerance, bool log_errors) const
Advanced usage: Verifies the correctness of the solution.
virtual OptimizationProblemType ProblemType() const
Returns the optimization problem type set at construction.
void SetMinimization()
Sets the optimization direction to minimize.
virtual std::string ValidFileExtensionForParameterFile() const
std::string AbslUnparseFlag(MPSolver::OptimizationProblemType solver_type)
virtual bool SupportsCallbacks() const
MPConstraint * MakeRowConstraint()
Creates a constraint with -infinity and +infinity bounds.
void set_is_lazy(bool laziness)
Advanced usage: sets the constraint "laziness".
@ CPLEX_LINEAR_PROGRAMMING
double unrounded_solution_value() const
Advanced usage: unrounded solution value.
static const double kDefaultPrimalTolerance
void SetTimeLimit(absl::Duration time_limit)
virtual int64 nodes() const =0
friend class MPVariableSolutionValueTest
std::string GetSolverSpecificParametersAsString() const
virtual void SetCoefficient(MPConstraint *const constraint, const MPVariable *const variable, double new_value, double old_value)=0
@ INCREMENTALITY
Advanced usage: incrementality from one solve to the next.
MPSolver::BasisStatus basis_status() const
Advanced usage: returns the basis status of the variable in the current solution (only available for ...
const std::string & name() const
Returns the name of the constraint.
virtual void SetIntegerParamToUnsupportedValue(MPSolverParameters::IntegerParam param, int value)
MPConstraint(int index, double lb, double ub, const std::string &name, MPSolverInterface *const interface_in)
void SetOffset(double value)
Sets the constant term in the objective.
int index() const
Returns the index of the constraint in the MPSolver::constraints_.
ResultStatus Solve()
Solves the problem using the default parameter values.
void SetCommonParameters(const MPSolverParameters ¶m)
ScalingValues
Advanced usage: Scaling options.
bool AbslParseFlag(const absl::string_view text, MPSolver::OptimizationProblemType *solver_type, std::string *error)
virtual void BranchingPriorityChangedForVariable(int var_index)
virtual MPSolver::BasisStatus row_status(int constraint_index) const =0
MPVariable(int index, double lb, double ub, bool integer, const std::string &name, MPSolverInterface *const interface_in)
void Reset()
Sets all parameters to their default value.
void Clear()
Clears the objective (including the optimization direction), all variables and constraints.
void set_dual_value(double dual_value)
bool is_lazy() const
Advanced usage: returns true if the constraint is "lazy" (see below).
IncrementalityValues
Advanced usage: Incrementality options.
void set_solution_value(double value)
virtual void SetPresolveMode(int value)=0
bool CheckSolutionIsSynchronizedAndExists() const
@ XPRESS_MIXED_INTEGER_PROGRAMMING
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...
double reduced_cost() const
Advanced usage: returns the reduced cost of the variable in the current solution (only available for ...
int64 nodes() const
Returns the number of branch-and-bound nodes evaluated during the solve.
virtual void AddRowConstraint(MPConstraint *const ct)=0
MPSolver::BasisStatus basis_status() const
Advanced usage: returns the basis status of the constraint.
virtual std::string SolverVersion() const =0
MPSolverParameters()
The constructor sets all parameters to their default value.
static const int kDefaultIntegerParamValue
@ SAT_INTEGER_PROGRAMMING
bool OwnsVariable(const MPVariable *var) const
void set_constraint_as_extracted(int ct_index, bool extracted)
virtual MPSolver::ResultStatus Solve(const MPSolverParameters ¶m)=0
@ ABNORMAL
abnormal, i.e., error of some kind.
void SetBounds(double lb, double ub)
Sets both the lower and upper bounds.
static bool LoadGurobiSharedLibrary()
void ResetExtractionInformation()
double objective_value() const
static constexpr int64 kUnknownNumberOfNodes
absl::Status SetNumThreads(int num_threads)
Sets the number of threads to use by the underlying solver.
LinearExpr models a quantity that is linear in the decision variables (MPVariable) of an optimization...
@ INCREMENTALITY_OFF
Start solve from scratch.
friend class SLMInterface
MPVariable * LookupVariableOrNull(const std::string &var_name) const
Looks up a variable by name, and returns nullptr if it does not exist.
static const int kUnknownIntegerParamValue
virtual void SetObjectiveOffset(double value)=0
static bool ParseSolverType(absl::string_view solver_id, OptimizationProblemType *type)
Parses the name of the solver.
virtual int64 iterations() const =0
double lb() const
Returns the lower bound.
friend class CplexInterface
void SetInteger(bool integer)
Sets the integrality requirement of the variable.
friend class SLMInterface
virtual absl::Status SetNumThreads(int num_threads)
@ SCIP_MIXED_INTEGER_PROGRAMMING
virtual void AddVariable(MPVariable *const var)=0
virtual void SetCallback(MPCallback *mp_callback)
bool integer() const
Returns the integrality requirement of the variable.
virtual void SetParameters(const MPSolverParameters ¶m)=0
virtual double best_objective_bound() const =0
absl::Duration TimeLimit() const
@ GUROBI_MIXED_INTEGER_PROGRAMMING
IntegerParam
Enumeration of parameters that take integer or categorical values.
void MakeVarArray(int nb, double lb, double ub, bool integer, const std::string &name_prefix, std::vector< MPVariable * > *vars)
Creates an array of variables.
@ SCALING_ON
Scaling is on.
virtual void SetRelativeMipGap(double value)=0
bool SupportsCallbacks() const
virtual bool CheckBestObjectiveBoundExists() const
void MaximizeLinearExpr(const LinearExpr &linear_expr)
Resets the current objective to maximize linear_expr.
@ CBC_MIXED_INTEGER_PROGRAMMING
void FillSolutionResponseProto(MPSolutionResponse *response) const
Encodes the current solution in a solution response protocol buffer.
void SetMIPParameters(const MPSolverParameters ¶m)
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...
friend class GLPKInterface
MPObjective * MutableObjective()
Returns the mutable objective object.
virtual void SetScalingMode(int value)=0
virtual void Write(const std::string &filename)
absl::Status ClampSolutionWithinBounds()
Resets values of out of bound variables to the corresponding bound and returns an error if any of the...
@ PRESOLVE
Advanced usage: presolve mode.
MPVariable * MakeVar(double lb, double ub, bool integer, const std::string &name)
Creates a variable with the given bounds, integrality requirement and name.
void EnableOutput()
Enables solver logging.
MPVariable * MakeNumVar(double lb, double ub, const std::string &name)
Creates a continuous variable.
bool SetSolverSpecificParametersAsString(const std::string ¶meters)
Advanced usage: pass solver specific parameters in text format.
const MPObjective & Objective() const
Returns the objective object.
void SetDoubleParamToUnsupportedValue(MPSolverParameters::DoubleParam param, double value)
ResultStatus
The status of solving the problem.
friend class XpressInterface
OptimizationProblemType
The type of problems (LP or MIP) that will be solved and the underlying solver (GLOP,...
double ub() const
Returns the upper bound.
virtual void ExtractObjective()=0
const std::string & Name() const
Returns the name of the model set at construction.
double GetDoubleParam(MPSolverParameters::DoubleParam param) const
Returns the value of a double parameter.
void SetBounds(double lb, double ub)
Sets both the lower and upper bounds.
void ResetIntegerParam(MPSolverParameters::IntegerParam param)
Sets an integer parameter to its default value (default value defined in MPSolverParameters if it exi...
@ MODEL_INVALID
the model is trivially invalid (NaN coefficients, etc).
void SetUB(double ub)
Sets the upper bound.
const std::vector< MPConstraint * > & constraints() const
Returns the array of constraints handled by the MPSolver.
virtual void SetDualTolerance(double value)=0
void Write(const std::string &file_name)
Writes the model using the solver internal write function.
virtual void SetUnsupportedIntegerParam(MPSolverParameters::IntegerParam param)
virtual void SetConstraintBounds(int index, double lb, double ub)=0
bool maximization() const
Is the optimization direction set to maximize?
friend class SLMInterface
int GetNumThreads() const
Returns the number of threads to be used during solve.
friend class GLPKInterface
@ BARRIER
Barrier algorithm.
double Value() const
Returns the objective value of the best solution found so far.
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...
virtual void SetLpAlgorithm(int value)=0
const absl::flat_hash_map< const MPVariable *, double > & terms() const
Returns a map from variables to their coefficients in the constraint.
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...
@ BOP_INTEGER_PROGRAMMING
virtual void SetPrimalTolerance(double value)=0
A class to express a linear objective.
virtual void SetStartingLpBasis(const std::vector< MPSolver::BasisStatus > &variable_statuses, const std::vector< MPSolver::BasisStatus > &constraint_statuses)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
int NumVariables() const
Returns the number of variables.
@ PRIMAL_TOLERANCE
Advanced usage: tolerance for primal feasibility of basic solutions.
absl::Duration DurationSinceConstruction() const
friend class CplexInterface
double time_limit_in_secs() const
std::string SolverVersion() const
Returns a string describing the underlying solver and its version.
friend class GLPKInterface
BasisStatus
Advanced usage: possible basis status values for a variable and the slack variable of a linear constr...
MPSolver(const std::string &name, OptimizationProblemType problem_type)
Create a solver with the given name and underlying solver backend.
MPSolverResponseStatus LoadModelFromProto(const MPModelProto &input_model, std::string *error_message)
Loads model from protocol buffer.
static const double kDefaultDoubleParamValue
friend class SLMInterface
void AddLinearExpr(const LinearExpr &linear_expr)
Adds linear_expr to the current objective, does not change the direction.
const MPVariable * indicator_variable() const
bool MPSolverResponseStatusIsRpcError(MPSolverResponseStatus status)
void set_quiet(bool quiet_value)
std::vector< double > ComputeConstraintActivities() const
Advanced usage: compute the "activities" of all constraints, which are the sums of their linear terms...
bool constraint_is_extracted(int ct_index) const
double ComputeExactConditionNumber() const
Advanced usage: computes the exact condition number of the current scaled basis: L1norm(B) * L1norm(i...
@ INCREMENTALITY_ON
Reuse results from previous solve as much as the underlying solver allows.
constexpr double kDefaultPrimalTolerance
virtual void ClearObjective()=0
DoubleParam
Enumeration of parameters that take continuous values.
double solution_value() const
Returns the value of the variable in the current solution.
bool OutputIsEnabled() const
Controls (or queries) the amount of output produced by the underlying solver.
const std::vector< MPVariable * > & variables() const
Returns the array of variables handled by the MPSolver.
virtual absl::optional< MPSolutionResponse > DirectlySolveProto(const MPModelRequest &request)
static constexpr int64 kUnknownNumberOfIterations
std::ostream & operator<<(std::ostream &out, const Assignment &assignment)
void SetBranchingPriority(int priority)
void SetLB(double lb)
Sets the lower bound.
@ KNAPSACK_MIXED_INTEGER_PROGRAMMING
void SetHint(std::vector< std::pair< const MPVariable *, double > > hint)
Sets a hint for solution.
virtual void SetObjectiveCoefficient(const MPVariable *const variable, double coefficient)=0
void set_reduced_cost(double reduced_cost)
MPSolver::ResultStatus result_status() const
int last_constraint_index_
@ PRESOLVE_ON
Presolve is on.
friend class KnapsackInterface
double BestBound() const
Returns the best objective bound.
double trivial_worst_objective_bound() const
void Clear()
Clears the offset, all variables and coefficients, and the optimization direction.
double lb() const
Returns the lower bound.
void SetDoubleParam(MPSolverParameters::DoubleParam param, double value)
Sets a double parameter to a specific value.
void SetStartingLpBasis(const std::vector< MPSolver::BasisStatus > &variable_statuses, const std::vector< MPSolver::BasisStatus > &constraint_statuses)
Advanced usage: Incrementality.
virtual MPSolver::BasisStatus column_status(int variable_index) const =0
void SetOptimizationDirection(bool maximize)
Sets the optimization direction (maximize: true or minimize: false).
virtual bool AddIndicatorConstraint(MPConstraint *const ct)
static bool SupportsProblemType(OptimizationProblemType problem_type)
Whether the given problem type is supported (this will depend on the targets that you linked).
@ INFEASIBLE
proven infeasible.
int last_variable_index() const
friend class CplexInterface
@ GUROBI_LINEAR_PROGRAMMING
int64 iterations() const
Returns the number of simplex iterations.
SynchronizationStatus sync_status_
static const PresolveValues kDefaultPresolve
void InvalidateSolutionSynchronization()
void MakeNumVarArray(int nb, double lb, double ub, const std::string &name, std::vector< MPVariable * > *vars)
Creates an array of continuous variables.
virtual void SetVariableInteger(int index, bool integer)=0
@ UNBOUNDED
proven unbounded.
@ NOT_SOLVED
not been solved yet.
friend class GLPKInterface