Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <model_builder_helper.h>
The arguments of the functions defined below must follow these rules to be wrapped by SWIG correctly: 1) Their types must include the full operations_research:: namespace. 2) Their names must correspond to the ones declared in the .i file (see the java/ and csharp/ subdirectories). Helper for importing/exporting models and model protobufs.
Wrapping global function is brittle with SWIG. It is much easier to wrap static class methods.
Definition at line 47 of file model_builder_helper.h.
void operations_research::ModelBuilderHelper::AddConstraintTerm | ( | int | ct_index, |
int | var_index, | ||
double | coeff ) |
Definition at line 208 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::AddEnforcedConstraintTerm | ( | int | ct_index, |
int | var_index, | ||
double | coeff ) |
Definition at line 314 of file model_builder_helper.cc.
int operations_research::ModelBuilderHelper::AddEnforcedLinearConstraint | ( | ) |
Create the new general constraint, and force the type to indicator ct.
Definition at line 275 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::AddHint | ( | int | var_index, |
double | var_value ) |
Definition at line 465 of file model_builder_helper.cc.
int operations_research::ModelBuilderHelper::AddLinearConstraint | ( | ) |
Definition at line 188 of file model_builder_helper.cc.
int operations_research::ModelBuilderHelper::AddVar | ( | ) |
Direct low level model building API.
Definition at line 141 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::ClearConstraintTerms | ( | int | ct_index | ) |
Definition at line 202 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::ClearEnforcedConstraintTerms | ( | int | ct_index | ) |
Definition at line 306 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::ClearHints | ( | ) |
Definition at line 463 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::ClearObjective | ( | ) |
Definition at line 443 of file model_builder_helper.cc.
std::vector< double > operations_research::ModelBuilderHelper::ConstraintCoefficients | ( | int | ct_index | ) | const |
Definition at line 269 of file model_builder_helper.cc.
double operations_research::ModelBuilderHelper::ConstraintLowerBound | ( | int | ct_index | ) | const |
Definition at line 252 of file model_builder_helper.cc.
std::string operations_research::ModelBuilderHelper::ConstraintName | ( | int | ct_index | ) | const |
Definition at line 260 of file model_builder_helper.cc.
double operations_research::ModelBuilderHelper::ConstraintUpperBound | ( | int | ct_index | ) | const |
Definition at line 256 of file model_builder_helper.cc.
std::vector< int > operations_research::ModelBuilderHelper::ConstraintVarIndices | ( | int | ct_index | ) | const |
Definition at line 264 of file model_builder_helper.cc.
std::vector< double > operations_research::ModelBuilderHelper::EnforcedConstraintCoefficients | ( | int | ct_index | ) | const |
Definition at line 412 of file model_builder_helper.cc.
double operations_research::ModelBuilderHelper::EnforcedConstraintLowerBound | ( | int | ct_index | ) | const |
Definition at line 383 of file model_builder_helper.cc.
std::string operations_research::ModelBuilderHelper::EnforcedConstraintName | ( | int | ct_index | ) | const |
Definition at line 399 of file model_builder_helper.cc.
double operations_research::ModelBuilderHelper::EnforcedConstraintUpperBound | ( | int | ct_index | ) | const |
Definition at line 391 of file model_builder_helper.cc.
std::vector< int > operations_research::ModelBuilderHelper::EnforcedConstraintVarIndices | ( | int | ct_index | ) | const |
Definition at line 404 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::EnforcedIndicatorValue | ( | int | ct_index | ) | const |
Definition at line 425 of file model_builder_helper.cc.
int operations_research::ModelBuilderHelper::EnforcedIndicatorVariableIndex | ( | int | ct_index | ) | const |
Definition at line 420 of file model_builder_helper.cc.
std::string operations_research::ModelBuilderHelper::ExportToLpString | ( | const operations_research::MPModelExportOptions & | options = MPModelExportOptions() | ) |
Definition at line 66 of file model_builder_helper.cc.
std::string operations_research::ModelBuilderHelper::ExportToMpsString | ( | const operations_research::MPModelExportOptions & | options = MPModelExportOptions() | ) |
Definition at line 60 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::ImportFromMpsFile | ( | const std::string & | mps_file | ) |
Definition at line 109 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::ImportFromMpsString | ( | const std::string & | mps_string | ) |
See comment in the header file why we need to wrap absl::Status code with code having simpler APIs.
Definition at line 101 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::IsEnforcedConstraint | ( | int | ct_index | ) | const |
Definition at line 282 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::maximize | ( | ) | const |
Definition at line 449 of file model_builder_helper.cc.
const MPModelProto & operations_research::ModelBuilderHelper::model | ( | ) | const |
Definition at line 137 of file model_builder_helper.cc.
MPModelProto * operations_research::ModelBuilderHelper::mutable_model | ( | ) |
Definition at line 139 of file model_builder_helper.cc.
std::string operations_research::ModelBuilderHelper::name | ( | ) | const |
Definition at line 438 of file model_builder_helper.cc.
int operations_research::ModelBuilderHelper::num_constraints | ( | ) | const |
Definition at line 434 of file model_builder_helper.cc.
int operations_research::ModelBuilderHelper::num_variables | ( | ) | const |
Definition at line 432 of file model_builder_helper.cc.
double operations_research::ModelBuilderHelper::ObjectiveOffset | ( | ) | const |
Definition at line 455 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::OverwriteModel | ( | const ModelBuilderHelper & | other_helper | ) |
Definition at line 55 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::ReadModelFromProtoFile | ( | const std::string & | filename | ) |
Definition at line 77 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SafeAddConstraintTerm | ( | int | ct_index, |
int | var_index, | ||
double | coeff ) |
If we reach this point, the variable does not exist in the constraint yet, so we add it to the constraint as a new term.
Definition at line 216 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SafeAddEnforcedConstraintTerm | ( | int | ct_index, |
int | var_index, | ||
double | coeff ) |
If we reach this point, the variable does not exist in the constraint yet, so we add it to the constraint as a new term.
Definition at line 325 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetConstraintCoefficient | ( | int | ct_index, |
int | var_index, | ||
double | coeff ) |
If we reach this point, the variable does not exist in the constraint yet, so we add it to the constraint as a new term.
Definition at line 237 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetConstraintLowerBound | ( | int | ct_index, |
double | lb ) |
Definition at line 194 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetConstraintName | ( | int | ct_index, |
const std::string & | name ) |
Definition at line 232 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetConstraintUpperBound | ( | int | ct_index, |
double | ub ) |
Definition at line 198 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetEnforcedConstraintCoefficient | ( | int | ct_index, |
int | var_index, | ||
double | coeff ) |
If we reach this point, the variable does not exist in the constraint yet, so we add it to the constraint as a new term.
Definition at line 350 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetEnforcedConstraintLowerBound | ( | int | ct_index, |
double | lb ) |
Definition at line 288 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetEnforcedConstraintName | ( | int | ct_index, |
const std::string & | name ) |
Definition at line 345 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetEnforcedConstraintUpperBound | ( | int | ct_index, |
double | ub ) |
Definition at line 297 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetEnforcedIndicatorValue | ( | int | ct_index, |
bool | positive ) |
Definition at line 376 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetEnforcedIndicatorVariableIndex | ( | int | ct_index, |
int | var_index ) |
Definition at line 369 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetMaximize | ( | bool | maximize | ) |
Definition at line 451 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetName | ( | const std::string & | name | ) |
Definition at line 440 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetObjectiveOffset | ( | double | offset | ) |
Definition at line 459 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetVarIntegrality | ( | int | var_index, |
bool | is_integer ) |
Definition at line 155 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetVarLowerBound | ( | int | var_index, |
double | lb ) |
Definition at line 147 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetVarName | ( | int | var_index, |
const std::string & | name ) |
Definition at line 164 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetVarObjectiveCoefficient | ( | int | var_index, |
double | coeff ) |
Definition at line 159 of file model_builder_helper.cc.
void operations_research::ModelBuilderHelper::SetVarUpperBound | ( | int | var_index, |
double | ub ) |
Definition at line 151 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::VarIsIntegral | ( | int | var_index | ) | const |
Definition at line 176 of file model_builder_helper.cc.
double operations_research::ModelBuilderHelper::VarLowerBound | ( | int | var_index | ) | const |
Definition at line 168 of file model_builder_helper.cc.
std::string operations_research::ModelBuilderHelper::VarName | ( | int | var_index | ) | const |
Definition at line 184 of file model_builder_helper.cc.
double operations_research::ModelBuilderHelper::VarObjectiveCoefficient | ( | int | var_index | ) | const |
Definition at line 180 of file model_builder_helper.cc.
double operations_research::ModelBuilderHelper::VarUpperBound | ( | int | var_index | ) | const |
Definition at line 172 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::WriteModelToProtoFile | ( | const std::string & | filename | ) |
Definition at line 91 of file model_builder_helper.cc.
bool operations_research::ModelBuilderHelper::WriteToMpsFile | ( | const std::string & | filename, |
const operations_research::MPModelExportOptions & | options = MPModelExportOptions() ) |
Definition at line 72 of file model_builder_helper.cc.