![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
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 .swig 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 324 of file model_builder_helper.h.
#include <model_builder_helper.h>
Public Member Functions | |
| void | OverwriteModel (const ModelBuilderHelper &other_helper) |
| ModelBuilderHelper. | |
| std::string | ExportToMpsString (const operations_research::MPModelExportOptions &options=MPModelExportOptions()) |
| std::string | ExportToLpString (const operations_research::MPModelExportOptions &options=MPModelExportOptions()) |
| bool | WriteToMpsFile (const std::string &filename, const operations_research::MPModelExportOptions &options=MPModelExportOptions()) |
| bool | ReadModelFromProtoFile (const std::string &filename) |
| bool | WriteModelToProtoFile (const std::string &filename) |
| bool | ImportFromMpsString (const std::string &mps_string) |
| bool | ImportFromMpsFile (const std::string &mps_file) |
| bool | ImportFromLpString (const std::string &lp_string) |
| bool | ImportFromLpFile (const std::string &lp_file) |
| const MPModelProto & | model () const |
| MPModelProto * | mutable_model () |
| int | AddVar () |
| Direct low level model building API. | |
| void | SetVarLowerBound (int var_index, double lb) |
| void | SetVarUpperBound (int var_index, double ub) |
| void | SetVarIntegrality (int var_index, bool is_integer) |
| void | SetVarObjectiveCoefficient (int var_index, double coeff) |
| void | SetVarName (int var_index, const std::string &name) |
| double | VarLowerBound (int var_index) const |
| double | VarUpperBound (int var_index) const |
| bool | VarIsIntegral (int var_index) const |
| double | VarObjectiveCoefficient (int var_index) const |
| std::string | VarName (int var_index) const |
| double | ConstraintLowerBound (int ct_index) const |
| double | ConstraintUpperBound (int ct_index) const |
| int | AddLinearConstraint () |
| std::string | ConstraintName (int ct_index) const |
| std::vector< double > | ConstraintCoefficients (int ct_index) const |
| std::vector< int > | ConstraintVarIndices (int ct_index) const |
| void | AddConstraintTerm (int ct_index, int var_index, double coeff) |
| void | ClearConstraintTerms (int ct_index) |
| void | SafeAddConstraintTerm (int ct_index, int var_index, double coeff) |
| void | SetConstraintCoefficient (int ct_index, int var_index, double coeff) |
| void | SetConstraintLowerBound (int ct_index, double lb) |
| void | SetConstraintName (int ct_index, const std::string &name) |
| void | SetConstraintUpperBound (int ct_index, double ub) |
| bool | EnforcedIndicatorValue (int ct_index) const |
| bool | IsEnforcedConstraint (int ct_index) const |
| double | EnforcedConstraintLowerBound (int ct_index) const |
| double | EnforcedConstraintUpperBound (int ct_index) const |
| int | AddEnforcedLinearConstraint () |
| int | EnforcedIndicatorVariableIndex (int ct_index) const |
| std::string | EnforcedConstraintName (int ct_index) const |
| std::vector< double > | EnforcedConstraintCoefficients (int ct_index) const |
| std::vector< int > | EnforcedConstraintVarIndices (int ct_index) const |
| void | AddEnforcedConstraintTerm (int ct_index, int var_index, double coeff) |
| void | ClearEnforcedConstraintTerms (int ct_index) |
| void | SafeAddEnforcedConstraintTerm (int ct_index, int var_index, double coeff) |
| void | SetEnforcedConstraintCoefficient (int ct_index, int var_index, double coeff) |
| void | SetEnforcedConstraintLowerBound (int ct_index, double lb) |
| void | SetEnforcedConstraintName (int ct_index, const std::string &name) |
| void | SetEnforcedConstraintUpperBound (int ct_index, double ub) |
| void | SetEnforcedIndicatorValue (int ct_index, bool positive) |
| void | SetEnforcedIndicatorVariableIndex (int ct_index, int var_index) |
| int | num_constraints () const |
| int | num_variables () const |
| std::string | name () const |
| void | SetName (const std::string &name) |
| void | ClearObjective () |
| bool | maximize () const |
| void | SetMaximize (bool maximize) |
| double | ObjectiveOffset () const |
| void | SetObjectiveOffset (double offset) |
| void | ClearHints () |
| void | AddHint (int var_index, double var_value) |
| void operations_research::mb::ModelBuilderHelper::AddConstraintTerm | ( | int | ct_index, |
| int | var_index, | ||
| double | coeff ) |
Definition at line 211 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::AddEnforcedConstraintTerm | ( | int | ct_index, |
| int | var_index, | ||
| double | coeff ) |
Definition at line 317 of file model_builder_helper.cc.
| int operations_research::mb::ModelBuilderHelper::AddEnforcedLinearConstraint | ( | ) |
Create the mew constraint, and force the type to indicator ct.
Definition at line 278 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::AddHint | ( | int | var_index, |
| double | var_value ) |
Definition at line 468 of file model_builder_helper.cc.
| int operations_research::mb::ModelBuilderHelper::AddLinearConstraint | ( | ) |
Definition at line 191 of file model_builder_helper.cc.
| int operations_research::mb::ModelBuilderHelper::AddVar | ( | ) |
Direct low level model building API.
Definition at line 144 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::ClearConstraintTerms | ( | int | ct_index | ) |
Definition at line 205 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::ClearEnforcedConstraintTerms | ( | int | ct_index | ) |
Definition at line 309 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::ClearHints | ( | ) |
Definition at line 466 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::ClearObjective | ( | ) |
Definition at line 446 of file model_builder_helper.cc.
| std::vector< double > operations_research::mb::ModelBuilderHelper::ConstraintCoefficients | ( | int | ct_index | ) | const |
Definition at line 272 of file model_builder_helper.cc.
| double operations_research::mb::ModelBuilderHelper::ConstraintLowerBound | ( | int | ct_index | ) | const |
Definition at line 255 of file model_builder_helper.cc.
| std::string operations_research::mb::ModelBuilderHelper::ConstraintName | ( | int | ct_index | ) | const |
Definition at line 263 of file model_builder_helper.cc.
| double operations_research::mb::ModelBuilderHelper::ConstraintUpperBound | ( | int | ct_index | ) | const |
Definition at line 259 of file model_builder_helper.cc.
| std::vector< int > operations_research::mb::ModelBuilderHelper::ConstraintVarIndices | ( | int | ct_index | ) | const |
Definition at line 267 of file model_builder_helper.cc.
| std::vector< double > operations_research::mb::ModelBuilderHelper::EnforcedConstraintCoefficients | ( | int | ct_index | ) | const |
Definition at line 415 of file model_builder_helper.cc.
| double operations_research::mb::ModelBuilderHelper::EnforcedConstraintLowerBound | ( | int | ct_index | ) | const |
Definition at line 386 of file model_builder_helper.cc.
| std::string operations_research::mb::ModelBuilderHelper::EnforcedConstraintName | ( | int | ct_index | ) | const |
Definition at line 402 of file model_builder_helper.cc.
| double operations_research::mb::ModelBuilderHelper::EnforcedConstraintUpperBound | ( | int | ct_index | ) | const |
Definition at line 394 of file model_builder_helper.cc.
| std::vector< int > operations_research::mb::ModelBuilderHelper::EnforcedConstraintVarIndices | ( | int | ct_index | ) | const |
Definition at line 407 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::EnforcedIndicatorValue | ( | int | ct_index | ) | const |
Definition at line 428 of file model_builder_helper.cc.
| int operations_research::mb::ModelBuilderHelper::EnforcedIndicatorVariableIndex | ( | int | ct_index | ) | const |
Definition at line 423 of file model_builder_helper.cc.
| std::string operations_research::mb::ModelBuilderHelper::ExportToLpString | ( | const operations_research::MPModelExportOptions & | options = MPModelExportOptions() | ) |
Definition at line 71 of file model_builder_helper.cc.
| std::string operations_research::mb::ModelBuilderHelper::ExportToMpsString | ( | const operations_research::MPModelExportOptions & | options = MPModelExportOptions() | ) |
Definition at line 65 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::ImportFromLpFile | ( | const std::string & | lp_file | ) |
Definition at line 129 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::ImportFromLpString | ( | const std::string & | lp_string | ) |
Definition at line 122 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::ImportFromMpsFile | ( | const std::string & | mps_file | ) |
Definition at line 114 of file model_builder_helper.cc.
| bool operations_research::mb::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 106 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::IsEnforcedConstraint | ( | int | ct_index | ) | const |
Definition at line 285 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::maximize | ( | ) | const |
Definition at line 452 of file model_builder_helper.cc.
| const MPModelProto & operations_research::mb::ModelBuilderHelper::model | ( | ) | const |
Definition at line 140 of file model_builder_helper.cc.
| MPModelProto * operations_research::mb::ModelBuilderHelper::mutable_model | ( | ) |
Definition at line 142 of file model_builder_helper.cc.
| std::string operations_research::mb::ModelBuilderHelper::name | ( | ) | const |
Definition at line 441 of file model_builder_helper.cc.
| int operations_research::mb::ModelBuilderHelper::num_constraints | ( | ) | const |
Definition at line 437 of file model_builder_helper.cc.
| int operations_research::mb::ModelBuilderHelper::num_variables | ( | ) | const |
Definition at line 435 of file model_builder_helper.cc.
| double operations_research::mb::ModelBuilderHelper::ObjectiveOffset | ( | ) | const |
Definition at line 458 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::OverwriteModel | ( | const ModelBuilderHelper & | other_helper | ) |
Definition at line 60 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::ReadModelFromProtoFile | ( | const std::string & | filename | ) |
Definition at line 82 of file model_builder_helper.cc.
| void operations_research::mb::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 219 of file model_builder_helper.cc.
| void operations_research::mb::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 328 of file model_builder_helper.cc.
| void operations_research::mb::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 newterm.
Definition at line 240 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetConstraintLowerBound | ( | int | ct_index, |
| double | lb ) |
Definition at line 197 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetConstraintName | ( | int | ct_index, |
| const std::string & | name ) |
Definition at line 235 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetConstraintUpperBound | ( | int | ct_index, |
| double | ub ) |
Definition at line 201 of file model_builder_helper.cc.
| void operations_research::mb::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 353 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetEnforcedConstraintLowerBound | ( | int | ct_index, |
| double | lb ) |
Definition at line 291 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetEnforcedConstraintName | ( | int | ct_index, |
| const std::string & | name ) |
Definition at line 348 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetEnforcedConstraintUpperBound | ( | int | ct_index, |
| double | ub ) |
Definition at line 300 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetEnforcedIndicatorValue | ( | int | ct_index, |
| bool | positive ) |
Definition at line 379 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetEnforcedIndicatorVariableIndex | ( | int | ct_index, |
| int | var_index ) |
Definition at line 372 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetMaximize | ( | bool | maximize | ) |
Definition at line 454 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetName | ( | const std::string & | name | ) |
Definition at line 443 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetObjectiveOffset | ( | double | offset | ) |
Definition at line 462 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetVarIntegrality | ( | int | var_index, |
| bool | is_integer ) |
Definition at line 158 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetVarLowerBound | ( | int | var_index, |
| double | lb ) |
Definition at line 150 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetVarName | ( | int | var_index, |
| const std::string & | name ) |
Definition at line 167 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetVarObjectiveCoefficient | ( | int | var_index, |
| double | coeff ) |
Definition at line 162 of file model_builder_helper.cc.
| void operations_research::mb::ModelBuilderHelper::SetVarUpperBound | ( | int | var_index, |
| double | ub ) |
Definition at line 154 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::VarIsIntegral | ( | int | var_index | ) | const |
Definition at line 179 of file model_builder_helper.cc.
| double operations_research::mb::ModelBuilderHelper::VarLowerBound | ( | int | var_index | ) | const |
Definition at line 171 of file model_builder_helper.cc.
| std::string operations_research::mb::ModelBuilderHelper::VarName | ( | int | var_index | ) | const |
Definition at line 187 of file model_builder_helper.cc.
| double operations_research::mb::ModelBuilderHelper::VarObjectiveCoefficient | ( | int | var_index | ) | const |
Definition at line 183 of file model_builder_helper.cc.
| double operations_research::mb::ModelBuilderHelper::VarUpperBound | ( | int | var_index | ) | const |
Definition at line 175 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::WriteModelToProtoFile | ( | const std::string & | filename | ) |
Definition at line 96 of file model_builder_helper.cc.
| bool operations_research::mb::ModelBuilderHelper::WriteToMpsFile | ( | const std::string & | filename, |
| const operations_research::MPModelExportOptions & | options = MPModelExportOptions() ) |
Definition at line 77 of file model_builder_helper.cc.