Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <lp_model.h>
Public Member Functions | |
LpModel ()=default | |
absl::StatusOr< VariableIndex > | AddVariable (absl::string_view name) |
absl::StatusOr< ConstraintIndex > | AddConstraint (Constraint constraint) |
const absl::flat_hash_map< std::string, VariableIndex > & | variable_names () const |
const util_intops::StrongVector< VariableIndex, std::string > & | variables () const |
const util_intops::StrongVector< ConstraintIndex, Constraint > & | constraints () const |
The contents of an optimization model in LP file format.
You can convert this to a string in the LP file format using <<, and read from a string in the LP file format using ParseLp from parse_lp.h.
Definition at line 49 of file lp_model.h.
|
default |
absl::StatusOr< ConstraintIndex > operations_research::lp_format::LpModel::AddConstraint | ( | Constraint | constraint | ) |
Adds a new constraint to the model and returns its index.
Errors if:
Constraint names can be repeated but this is not recommended.
Definition at line 77 of file lp_model.cc.
absl::StatusOr< VariableIndex > operations_research::lp_format::LpModel::AddVariable | ( | absl::string_view | name | ) |
Adds a new variable to the model and returns it. Errors if name:
Variable names are case sensitive.
Definition at line 106 of file lp_model.cc.
|
inline |
Definition at line 81 of file lp_model.h.
|
inline |
Definition at line 73 of file lp_model.h.
|
inline |
Definition at line 77 of file lp_model.h.