Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
Public Member Functions | |
CLPInterface (MPSolver *solver) | |
Constructor that takes a name for the underlying CLP solver. | |
~CLPInterface () override | |
void | SetOptimizationDirection (bool maximize) override |
Sets the optimization direction (min/max). | |
MPSolver::ResultStatus | Solve (const MPSolverParameters ¶m) override |
Extracts model and solve the LP/MIP. Returns the status of the search. | |
void | Reset () override |
void | SetVariableBounds (int var_index, double lb, double ub) override |
Modify bounds. | |
void | SetVariableInteger (int var_index, bool integer) override |
Ignore as CLP does not solve models with integer variables. | |
void | SetConstraintBounds (int row_index, double lb, double ub) override |
Modify bounds of an extracted variable. | |
void | AddRowConstraint (MPConstraint *ct) override |
Add constraint incrementally. | |
void | AddVariable (MPVariable *var) override |
Add variable incrementally. | |
void | SetCoefficient (MPConstraint *constraint, const MPVariable *variable, double new_value, double old_value) override |
Change a coefficient in a constraint. | |
void | ClearConstraint (MPConstraint *constraint) override |
Clear a constraint from all its terms. | |
void | SetObjectiveCoefficient (const MPVariable *variable, double coefficient) override |
Change a coefficient in the linear objective. | |
void | SetObjectiveOffset (double offset) override |
Change the constant term in the linear objective. | |
void | ClearObjective () override |
Clear the objective from all its terms. | |
int64_t | iterations () const override |
---— Query statistics on the solution and the solve ---— | |
int64_t | nodes () const override |
Number of branch-and-bound nodes. Only available for discrete problems. | |
MPSolver::BasisStatus | row_status (int constraint_index) const override |
Returns the basis status of a row. | |
MPSolver::BasisStatus | column_status (int variable_index) const override |
Returns the basis status of a column. | |
bool | IsContinuous () const override |
bool | IsLP () const override |
Returns true if the problem is continuous and linear. | |
bool | IsMIP () const override |
Returns true if the problem is discrete and linear. | |
void | ExtractNewVariables () override |
Define new variables and add them to existing constraints. | |
void | ExtractNewConstraints () override |
Define new constraints on old and new variables. | |
void | ExtractObjective () override |
Extracts the objective. | |
std::string | SolverVersion () const override |
Returns a string describing the underlying solver and its version. | |
void * | underlying_solver () override |
Returns the underlying solver. | |
Public Member Functions inherited from operations_research::MPSolverInterface | |
MPSolverInterface (MPSolver *solver) | |
virtual | ~MPSolverInterface () |
virtual bool | SupportsDirectlySolveProto (std::atomic< bool > *) const |
virtual MPSolutionResponse | DirectlySolveProto (LazyMutableCopy< MPModelRequest >, std::atomic< bool > *) |
virtual void | Write (const std::string &filename) |
virtual bool | AddIndicatorConstraint (MPConstraint *const) |
virtual void | BranchingPriorityChangedForVariable (int) |
double | best_objective_bound () const |
double | objective_value () const |
Returns the objective value of the best solution found so far. | |
bool | CheckSolutionIsSynchronized () const |
virtual bool | CheckSolutionExists () const |
bool | CheckSolutionIsSynchronizedAndExists () const |
Handy shortcut to do both checks above (it is often used). | |
int | last_variable_index () const |
Returns the index of the last variable extracted. | |
bool | variable_is_extracted (int var_index) const |
void | set_variable_as_extracted (int var_index, bool extracted) |
bool | constraint_is_extracted (int ct_index) const |
void | set_constraint_as_extracted (int ct_index, bool extracted) |
bool | quiet () const |
Returns the boolean indicating the verbosity of the solver output. | |
void | set_quiet (bool quiet_value) |
Sets the boolean indicating the verbosity of the solver output. | |
MPSolver::ResultStatus | result_status () const |
Returns the result status of the last solve. | |
virtual double | ComputeExactConditionNumber () const |
virtual void | SetStartingLpBasis (const std::vector< MPSolver::BasisStatus > &, const std::vector< MPSolver::BasisStatus > &) |
See MPSolver::SetStartingLpBasis(). | |
virtual double | infinity () |
virtual bool | InterruptSolve () |
virtual bool | NextSolution () |
See MPSolver::NextSolution() for contract. | |
virtual void | SetCallback (MPCallback *) |
See MPSolver::SetCallback() for details. | |
virtual bool | SupportsCallbacks () const |
Additional Inherited Members | |
Public Types inherited from operations_research::MPSolverInterface | |
enum | SynchronizationStatus { MUST_RELOAD , MODEL_SYNCHRONIZED , SOLUTION_SYNCHRONIZED } |
Static Public Attributes inherited from operations_research::MPSolverInterface | |
static constexpr int64_t | kUnknownNumberOfIterations = -1 |
static constexpr int64_t | kUnknownNumberOfNodes = -1 |
Protected Member Functions inherited from operations_research::MPSolverInterface | |
void | ExtractModel () |
Extracts model stored in MPSolver. | |
void | ResetExtractionInformation () |
Resets the extraction information. | |
void | InvalidateSolutionSynchronization () |
void | SetCommonParameters (const MPSolverParameters ¶m) |
Sets parameters common to LP and MIP in the underlying solver. | |
void | SetMIPParameters (const MPSolverParameters ¶m) |
Sets MIP specific parameters in the underlying solver. | |
void | SetUnsupportedDoubleParam (MPSolverParameters::DoubleParam param) |
Sets an unsupported double parameter. | |
virtual void | SetUnsupportedIntegerParam (MPSolverParameters::IntegerParam param) |
Sets an unsupported integer parameter. | |
void | SetDoubleParamToUnsupportedValue (MPSolverParameters::DoubleParam param, double value) |
Sets a supported double parameter to an unsupported value. | |
virtual void | SetIntegerParamToUnsupportedValue (MPSolverParameters::IntegerParam param, int value) |
Sets a supported integer parameter to an unsupported value. | |
virtual absl::Status | SetNumThreads (int num_threads) |
Sets the number of threads to be used by the solver. | |
virtual bool | SetSolverSpecificParametersAsString (const std::string ¶meters) |
Protected Attributes inherited from operations_research::MPSolverInterface | |
MPSolver *const | solver_ |
SynchronizationStatus | sync_status_ |
Indicates whether the model and the solution are synchronized. | |
MPSolver::ResultStatus | result_status_ |
bool | maximize_ |
Optimization direction. | |
int | last_constraint_index_ |
Index in MPSolver::variables_ of last constraint extracted. | |
int | last_variable_index_ |
Index in MPSolver::constraints_ of last variable extracted. | |
double | objective_value_ |
The value of the objective function. | |
double | best_objective_bound_ |
The value of the best objective bound. Used only for MIP solvers. | |
bool | quiet_ |
Boolean indicator for the verbosity of the solver output. | |
Static Protected Attributes inherited from operations_research::MPSolverInterface | |
static const int | kDummyVariableIndex = 0 |
-------— MPSolverInterface -------— | |
Definition at line 42 of file clp_interface.cc.
|
explicit |
Constructor that takes a name for the underlying CLP solver.
--— Solver --—
Creates a LP/MIP instance with the specified name and minimization objective.
Definition at line 138 of file clp_interface.cc.
|
override |
Definition at line 144 of file clp_interface.cc.
|
overridevirtual |
Add constraint incrementally.
Implements operations_research::MPSolverInterface.
Definition at line 262 of file clp_interface.cc.
|
overridevirtual |
Add variable incrementally.
Implements operations_research::MPSolverInterface.
Definition at line 266 of file clp_interface.cc.
|
overridevirtual |
Clear a constraint from all its terms.
Not cached.
Constraint may not have been extracted yet.
Implements operations_research::MPSolverInterface.
Definition at line 212 of file clp_interface.cc.
|
overridevirtual |
Clear the objective from all its terms.
Clear objective of all its terms.
Clear linear terms
Variable may have not been extracted yet.
Clear constant term.
Implements operations_research::MPSolverInterface.
Definition at line 245 of file clp_interface.cc.
|
overridevirtual |
Returns the basis status of a column.
Implements operations_research::MPSolverInterface.
Definition at line 552 of file clp_interface.cc.
|
overridevirtual |
Define new constraints on old and new variables.
Find the length of the longest row.
Make space for dummy variable.
Add each new constraint.
Add dummy variable to be able to build the constraint.
Add and name the rows.
Implements operations_research::MPSolverInterface.
Definition at line 337 of file clp_interface.cc.
|
overridevirtual |
Define new variables and add them to existing constraints.
Define new variables
Faster extraction when nothing has been extracted yet.
The true objective coefficient will be set later in ExtractObjective.
Add new variables to existing constraints.
Implements operations_research::MPSolverInterface.
Definition at line 281 of file clp_interface.cc.
|
overridevirtual |
Extracts the objective.
Linear objective: set objective coefficients for all variables (some might have been modified)
Constant term. Use -offset instead of +offset because CLP does not follow conventions.
Implements operations_research::MPSolverInterface.
Definition at line 388 of file clp_interface.cc.
|
inlineoverridevirtual |
--— Misc --— Query problem type.
Implements operations_research::MPSolverInterface.
Definition at line 95 of file clp_interface.cc.
|
inlineoverridevirtual |
Returns true if the problem is continuous and linear.
Implements operations_research::MPSolverInterface.
Definition at line 96 of file clp_interface.cc.
|
inlineoverridevirtual |
Returns true if the problem is discrete and linear.
Implements operations_research::MPSolverInterface.
Definition at line 97 of file clp_interface.cc.
|
overridevirtual |
---— Query statistics on the solution and the solve ---—
---— Query statistics on the solution and the solve ---— Number of simplex iterations
Implements operations_research::MPSolverInterface.
Definition at line 534 of file clp_interface.cc.
|
overridevirtual |
Number of branch-and-bound nodes. Only available for discrete problems.
Implements operations_research::MPSolverInterface.
Definition at line 539 of file clp_interface.cc.
|
overridevirtual |
--— Model modifications and extraction --— Resets extracted model
Implements operations_research::MPSolverInterface.
Definition at line 146 of file clp_interface.cc.
|
overridevirtual |
Returns the basis status of a row.
Implements operations_research::MPSolverInterface.
Definition at line 544 of file clp_interface.cc.
|
overridevirtual |
Change a coefficient in a constraint.
The modification of the coefficient for an extracted row and variable is not cached.
The modification of an unextracted row or variable is cached and handled in ExtractModel.
Implements operations_research::MPSolverInterface.
Definition at line 191 of file clp_interface.cc.
|
overridevirtual |
Modify bounds of an extracted variable.
Not cached if the row has been extracted
Implements operations_research::MPSolverInterface.
Definition at line 180 of file clp_interface.cc.
|
overridevirtual |
Change a coefficient in the linear objective.
Cached.
Implements operations_research::MPSolverInterface.
Definition at line 225 of file clp_interface.cc.
|
overridevirtual |
Change the constant term in the linear objective.
Cached.
Constant term. Use -offset instead of +offset because CLP does not follow conventions.
Implements operations_research::MPSolverInterface.
Definition at line 237 of file clp_interface.cc.
|
overridevirtual |
Sets the optimization direction (min/max).
Not cached.
Implements operations_research::MPSolverInterface.
Definition at line 161 of file clp_interface.cc.
|
overridevirtual |
Modify bounds.
Not cached if the variable has been extracted
Implements operations_research::MPSolverInterface.
Definition at line 166 of file clp_interface.cc.
|
overridevirtual |
Ignore as CLP does not solve models with integer variables.
Implements operations_research::MPSolverInterface.
Definition at line 178 of file clp_interface.cc.
|
overridevirtual |
Extracts model and solve the LP/MIP. Returns the status of the search.
--— Solve --— Solve the problem using the parameter values specified.
Set log level.
Special case if the model is empty since CLP is not able to handle this special case by itself.
Time limit.
Start from a fresh set of default parameters and set them to specified values.
Solve
Check the status: optimal, infeasible, etc.
Get the results
Implements operations_research::MPSolverInterface.
Definition at line 402 of file clp_interface.cc.
|
inlineoverridevirtual |
Returns a string describing the underlying solver and its version.
Implements operations_research::MPSolverInterface.
Definition at line 103 of file clp_interface.cc.
|
inlineoverridevirtual |
Returns the underlying solver.
Implements operations_research::MPSolverInterface.
Definition at line 105 of file clp_interface.cc.