![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
#include <model_storage_v2.h>
Public Member Functions | |
ModelStorageV2 (absl::string_view model_name="", absl::string_view primary_objective_name="") | |
Creates an empty minimization problem. | |
ModelStorageV2 (const ModelStorageV2 &)=delete | |
ModelStorageV2 & | operator= (const ModelStorageV2 &)=delete |
absl::Nonnull< std::unique_ptr< ModelStorageV2 > > | Clone (std::optional< absl::string_view > new_name=std::nullopt) const |
const std::string & | name () const |
VariableId | AddVariable (absl::string_view name="") |
VariableId | AddVariable (double lower_bound, double upper_bound, bool is_integer, absl::string_view name="") |
double | variable_lower_bound (VariableId id) const |
double | variable_upper_bound (VariableId id) const |
bool | is_variable_integer (VariableId id) const |
absl::string_view | variable_name (VariableId id) const |
void | set_variable_lower_bound (VariableId id, double lower_bound) |
void | set_variable_upper_bound (VariableId id, double upper_bound) |
void | set_variable_is_integer (VariableId id, bool is_integer) |
void | set_variable_as_integer (VariableId id) |
void | set_variable_as_continuous (VariableId id) |
void | DeleteVariable (VariableId id) |
int64_t | num_variables () const |
VariableId | next_variable_id () const |
void | ensure_next_variable_id_at_least (VariableId id) |
Sets the next variable id to be the maximum of next_variable_id() and id. | |
bool | has_variable (VariableId id) const |
Returns true if this id has been created and not yet deleted. | |
std::vector< VariableId > | variables () const |
std::vector< VariableId > | Variables () const |
The VariableIds in use (not deleted), order not defined. | |
std::vector< VariableId > | SortedVariables () const |
LinearConstraintId | AddLinearConstraint (absl::string_view name="") |
LinearConstraintId | AddLinearConstraint (double lower_bound, double upper_bound, absl::string_view name="") |
double | linear_constraint_lower_bound (LinearConstraintId id) const |
double | linear_constraint_upper_bound (LinearConstraintId id) const |
absl::string_view | linear_constraint_name (LinearConstraintId id) const |
void | set_linear_constraint_lower_bound (LinearConstraintId id, double lower_bound) |
void | set_linear_constraint_upper_bound (LinearConstraintId id, double upper_bound) |
void | DeleteLinearConstraint (LinearConstraintId id) |
int64_t | num_linear_constraints () const |
LinearConstraintId | next_linear_constraint_id () const |
void | ensure_next_linear_constraint_id_at_least (LinearConstraintId id) |
bool | has_linear_constraint (LinearConstraintId id) const |
Returns true if this id has been created and not yet deleted. | |
std::vector< LinearConstraintId > | LinearConstraints () const |
The LinearConstraintsIds in use (not deleted), order not defined. | |
std::vector< LinearConstraintId > | SortedLinearConstraints () const |
double | linear_constraint_coefficient (LinearConstraintId constraint, VariableId variable) const |
Returns 0.0 if the entry is not in matrix. | |
bool | is_linear_constraint_coefficient_nonzero (LinearConstraintId constraint, VariableId variable) const |
void | set_linear_constraint_coefficient (LinearConstraintId constraint, VariableId variable, double value) |
std::vector< std::tuple< LinearConstraintId, VariableId, double > > | linear_constraint_matrix () const |
std::vector< VariableId > | variables_in_linear_constraint (LinearConstraintId constraint) const |
Returns the variables with nonzero coefficients in a linear constraint. | |
std::vector< LinearConstraintId > | linear_constraints_with_variable (VariableId variable) const |
Returns the linear constraints with nonzero coefficients on a variable. | |
bool | is_maximize (ObjectiveId id) const |
int64_t | objective_priority (ObjectiveId id) const |
double | objective_offset (ObjectiveId id) const |
double | linear_objective_coefficient (ObjectiveId id, VariableId variable) const |
Returns 0.0 if this variable has no linear objective coefficient. | |
double | quadratic_objective_coefficient (ObjectiveId id, VariableId first_variable, VariableId second_variable) const |
The ordering of the input variables does not matter. | |
bool | is_linear_objective_coefficient_nonzero (ObjectiveId id, VariableId variable) const |
bool | is_quadratic_objective_coefficient_nonzero (ObjectiveId id, VariableId first_variable, VariableId second_variable) const |
The ordering of the input variables does not matter. | |
absl::string_view | objective_name (ObjectiveId id) const |
void | set_is_maximize (ObjectiveId id, bool is_maximize) |
void | set_maximize (ObjectiveId id) |
void | set_minimize (ObjectiveId id) |
void | set_objective_priority (ObjectiveId id, int64_t value) |
void | set_objective_offset (ObjectiveId id, double value) |
void | set_linear_objective_coefficient (ObjectiveId id, VariableId variable, double value) |
void | set_quadratic_objective_coefficient (ObjectiveId id, VariableId first_variable, VariableId second_variable, double value) |
void | clear_objective (ObjectiveId id) |
const absl::flat_hash_map< VariableId, double > & | linear_objective (ObjectiveId id) const |
The variables with nonzero linear objective coefficients. | |
std::vector< VariableId > | LinearObjectiveNonzeros (ObjectiveId id) const |
int64_t | num_linear_objective_terms (ObjectiveId id) const |
int64_t | num_quadratic_objective_terms (ObjectiveId id) const |
std::vector< std::tuple< VariableId, VariableId, double > > | quadratic_objective_terms (ObjectiveId id) const |
AuxiliaryObjectiveId | AddAuxiliaryObjective (int64_t priority, absl::string_view name="") |
void | DeleteAuxiliaryObjective (AuxiliaryObjectiveId id) |
int | num_auxiliary_objectives () const |
AuxiliaryObjectiveId | next_auxiliary_objective_id () const |
void | ensure_next_auxiliary_objective_id_at_least (AuxiliaryObjectiveId id) |
bool | has_auxiliary_objective (AuxiliaryObjectiveId id) const |
Returns true if this id has been created and not yet deleted. | |
std::vector< AuxiliaryObjectiveId > | AuxiliaryObjectives () const |
The AuxiliaryObjectiveIds in use (not deleted), order not defined. | |
std::vector< AuxiliaryObjectiveId > | SortedAuxiliaryObjectives () const |
template<typename ConstraintData> | |
ConstraintData::IdType | AddAtomicConstraint (ConstraintData data) |
template<typename IdType> | |
void | DeleteAtomicConstraint (IdType id) |
template<typename IdType> | |
const AtomicConstraintTraits< IdType >::ConstraintData & | constraint_data (IdType id) const |
Accesses the data object that fully represents a single atomic constraint. | |
template<typename IdType> | |
AtomicConstraintTraits< IdType >::ConstraintData | GetConstraintData (IdType id) const |
template<typename IdType> | |
int64_t | num_constraints () const |
template<typename IdType> | |
IdType | next_constraint_id () const |
template<typename IdType> | |
void | ensure_next_constraint_id_at_least (IdType id) |
template<typename IdType> | |
bool | has_constraint (IdType id) const |
Returns true if this id has been created and not yet deleted. | |
template<typename IdType> | |
std::vector< IdType > | Constraints () const |
Returns the constraint IDs in use (not deleted); order is not defined. | |
template<typename IdType> | |
std::vector< IdType > | SortedConstraints () const |
template<typename IdType> | |
std::vector< IdType > | ConstraintsWithVariable (VariableId variable_id) const |
template<typename IdType> | |
std::vector< VariableId > | VariablesInConstraint (IdType id) const |
Returns the variables appearing in the constraint. Order is not defined. | |
absl::StatusOr< ModelProto > | ExportModelV2 (bool remove_names=false) const |
ModelProto | ExportModel (const bool remove_names=false) const |
UpdateTrackerId | NewUpdateTracker () |
void | DeleteUpdateTracker (UpdateTrackerId update_tracker) |
absl::StatusOr< std::optional< ModelUpdateProto > > | ExportModelUpdateV2 (UpdateTrackerId update_tracker, bool remove_names=false) const |
std::optional< ModelUpdateProto > | ExportModelUpdate (const UpdateTrackerId update_tracker, const bool remove_names=false) const |
void | AdvanceCheckpoint (UpdateTrackerId update_tracker) |
absl::Status | ApplyUpdateProto (const ModelUpdateProto &update_proto) |
Static Public Member Functions | |
static absl::StatusOr< absl::Nonnull< std::unique_ptr< ModelStorageV2 > > > | FromModelProto (const ModelProto &model_proto) |
An index based C++ API for building & storing optimization problems.
It supports the efficient creation and modification of an optimization model, and the export of ModelProto and ModelUpdateProto protos.
All methods run in amortized O(1) (as amortized over calls to that exact function) unless otherwise specified.
Incrementalism, the ModelUpdate proto, and Checkpoints:
To update an existing model as specified by a Model proto, solvers consume a ModelUpdate proto, which describes the changes to a model (e.g. new variables or a change in a variable bound). ModelStorage::NewUpdateTracker() tracks the changes made and produces a ModelUpdate proto describing these changes with the method ModelStorage::ExportModelUpdate(). The changes returned will be the modifications since the previous call to ModelStorage::AdvanceCheckpoint(). Note that, for newly initialized models, before the first checkpoint, there is no additional memory overhead from tracking changes. See g3doc/ortools/math_opt/g3doc/model_building_complexity.md for details.
On bad input:
Using a bad variable id or constraint id (an id not in the current model, which includes ids that have been deleted) on any method will result in an immediate failure (either a CHECK failure or an exception, which is an implementation detail you should not rely on). We make no attempt to say if a model is invalid (e.g. a variable lower bound is infinite, exceeds an upper bound, or is NaN). The exported models are validated instead, see model_validator.h.
Definition at line 84 of file model_storage_v2.h.
|
inlineexplicit |
Creates an empty minimization problem.
Inlined function implementations
Definition at line 600 of file model_storage_v2.h.
|
delete |
|
inline |
Atomic Constraints
These methods do not directly require template specializations to add support for new constraint families; this should be handled automatically upon adding a specialization for AtomicConstraintTraits. Adds an atomic constraint to the model and returns its id.
The returned ids begin at zero and increase by one with each call to AddAtomicConstraint<ConstraintData>. Deleted ids are NOT reused. Callers may use ensure_next_constraint_id_at_least<ConstraintData> to configure custom indices.
Atomic constraint template inline implementations.
Definition at line 1056 of file model_storage_v2.h.
|
inline |
Auxiliary objectives Adds an auxiliary objective to the model and returns its id.
The returned ids begin at zero and increase by one with each call to AddAuxiliaryObjective. Deleted ids are NOT reused. If no auxiliary objectives are deleted, the ids in the model will be consecutive.
Objectives are minimized by default; you can change the sense via, e.g., set_is_maximize().
Auxiliary objectives
Definition at line 1001 of file model_storage_v2.h.
|
inline |
Linear Constraints Adds a linear constraint to the model with a lower bound of -inf and an upper bound of +inf and returns its id.
See AddLinearConstraint(double, double, absl::string_view) for details.
Linear Constraints
Definition at line 690 of file model_storage_v2.h.
|
inline |
Adds a linear constraint to the model returns its id.
The returned ids begin at zero and increase by one with each call to AddLinearConstraint. Deleted ids are NOT reused. If no linear constraints are deleted, the ids in the model will be consecutive.
Definition at line 695 of file model_storage_v2.h.
|
inline |
Variables Adds a continuous unbounded variable to the model and returns its id.
See AddVariable(double, double, bool, absl::string_view) for details.
Variables
Definition at line 611 of file model_storage_v2.h.
|
inline |
Adds a variable to the model and returns its id.
The returned ids begin at zero and increase by one with each call to AddVariable. Deleted ids are NOT reused. If no variables are deleted, the ids in the model will be consecutive.
Definition at line 616 of file model_storage_v2.h.
void operations_research::math_opt::ModelStorageV2::AdvanceCheckpoint | ( | UpdateTrackerId | update_tracker | ) |
Uses the current model state as the starting point to calculate the ModelUpdateProto next time ExportModelUpdate() is called.
Thread-safety: this method must not be used while modifying the ModelStorage or after calling DeleteUpdateTracker(). The user is expected to use proper synchronization primitive to serialize changes to the model and the use of this method.
It can be called concurrently for different update trackers though.
Definition at line 147 of file model_storage_v2.cc.
absl::Status operations_research::math_opt::ModelStorageV2::ApplyUpdateProto | ( | const ModelUpdateProto & | update_proto | ) |
Apply the provided update to this model. Returns a failure if the update is not valid.
As with FromModelProto(), duplicated names are ignored.
It takes O(num_variables + num_constraints) extra memory and execution to apply the update (due to the need to build a ModelSummary). So even a small update will have some cost.
Definition at line 155 of file model_storage_v2.cc.
|
inline |
The AuxiliaryObjectiveIds in use (not deleted), order not defined.
Definition at line 1032 of file model_storage_v2.h.
|
inline |
Equivalent to calling set_linear_objective_coefficient(v, 0.0) for every variable with nonzero objective coefficient, and setting the offset and quadratic terms to zero as well. Does not effect priority or direction.
Runs in O(# nonzero linear/quadratic objective terms).
Definition at line 941 of file model_storage_v2.h.
absl::Nonnull< std::unique_ptr< ModelStorageV2 > > operations_research::math_opt::ModelStorageV2::Clone | ( | std::optional< absl::string_view > | new_name = std::nullopt | ) | const |
Returns a clone of the model, optionally changing model's name.
The variables and constraints have the same ids. The clone will also not reused any id of variable/constraint that was deleted in the original.
Definition at line 85 of file model_storage_v2.cc.
|
inline |
Accesses the data object that fully represents a single atomic constraint.
Definition at line 1087 of file model_storage_v2.h.
std::vector< IdType > operations_research::math_opt::ModelStorageV2::Constraints | ( | ) | const |
Returns the constraint IDs in use (not deleted); order is not defined.
Definition at line 1129 of file model_storage_v2.h.
|
inline |
Returns the constraint in the given family in which the variable appears structurally (i.e., has a coefficient, possibly zero). Order is not defined.
Definition at line 1156 of file model_storage_v2.h.
|
inline |
Removes an atomic constraint from the model.
It is an error to use a deleted constraint id as input to any subsequent function calls on the model. Runs in O(variables in the constraint).
Definition at line 1066 of file model_storage_v2.h.
|
inline |
Removes an auxiliary objective from the model.
It is an error to use a deleted auxiliary objective id as input to any subsequent function calls on the model. Runs in O(variables in the auxiliary objective).
Definition at line 1008 of file model_storage_v2.h.
void operations_research::math_opt::ModelStorageV2::DeleteLinearConstraint | ( | LinearConstraintId | id | ) |
Removes a linear constraint from the model.
It is an error to use a deleted linear constraint id as input to any subsequent function calls on the model. Runs in O(variables in the linear constraint).
Definition at line 73 of file model_storage_v2.cc.
void operations_research::math_opt::ModelStorageV2::DeleteUpdateTracker | ( | UpdateTrackerId | update_tracker | ) |
Deletes the input tracker.
It must not be used anymore after its destruction. It can be deleted once, trying to delete it a second time or use it will raise an assertion (CHECK).
The update trackers are automatically deleted when the ModelStorage is destroyed. Calling this function is thus only useful for performance reasons, to ensure the ModelStorage does not keep data for update trackers that are not needed anymore.
Thread-safety: this method can be called at any time, even during the creation of other trackers or during model modification. It must not be called concurrently with ExportModelUpdate() or AdvanceCheckpoint() though.
Definition at line 129 of file model_storage_v2.cc.
void operations_research::math_opt::ModelStorageV2::DeleteVariable | ( | VariableId | id | ) |
Removes a variable from the model.
It is an error to use a deleted variable id as input to any subsequent function calls on the model. Runs in O(#constraints containing the variable).
Definition at line 68 of file model_storage_v2.cc.
|
inline |
Sets the next auxiliary objective id to be the maximum of next_auxiliary_objective_id() and id.
Definition at line 1022 of file model_storage_v2.h.
|
inline |
Sets the next atomic constraint id of the family corresponding to ConstraintData to be the maximum of next_constraint_id<ConstraintData>() and id.
Definition at line 1111 of file model_storage_v2.h.
|
inline |
Sets the next linear constraint id to be the maximum of next_linear_constraint_id() and id.
Definition at line 740 of file model_storage_v2.h.
|
inline |
Sets the next variable id to be the maximum of next_variable_id() and id.
Definition at line 676 of file model_storage_v2.h.
|
inline |
Definition at line 503 of file model_storage_v2.h.
|
inline |
Definition at line 552 of file model_storage_v2.h.
absl::StatusOr< std::optional< ModelUpdateProto > > operations_research::math_opt::ModelStorageV2::ExportModelUpdateV2 | ( | UpdateTrackerId | update_tracker, |
bool | remove_names = false ) const |
Returns a proto representation of the changes to the model since the most recent checkpoint (i.e. last time AdvanceCheckpoint() was called); nullopt if the update would have been empty.
Thread-safety: this method must not be used while modifying the ModelStorage or after calling DeleteUpdateTracker(). The user is expected to use proper synchronization primitive to serialize changes to the model and the use of this method.
It can be called concurrently for different update trackers though.
Definition at line 138 of file model_storage_v2.cc.
absl::StatusOr< ModelProto > operations_research::math_opt::ModelStorageV2::ExportModelV2 | ( | bool | remove_names = false | ) | const |
Export Returns a proto representation of the optimization model.
Returns an error if the model is too large to fit in a proto (requires putting more than 2**31 -1 elements in a RepeatedField).
See FromModelProto() to build a ModelStorage from a proto.
Definition at line 120 of file model_storage_v2.cc.
|
static |
Returns a storage from the input proto. Returns a failure status if the input proto is invalid.
Variable/constraint names can be repeated in the input proto but will be considered invalid when solving.
See ApplyUpdateProto() for dealing with subsequent updates.
Definition at line 80 of file model_storage_v2.cc.
|
inline |
Definition at line 1077 of file model_storage_v2.h.
|
inline |
Returns true if this id has been created and not yet deleted.
Definition at line 1027 of file model_storage_v2.h.
|
inline |
Returns true if this id has been created and not yet deleted.
Definition at line 1120 of file model_storage_v2.h.
|
inline |
Returns true if this id has been created and not yet deleted.
Definition at line 745 of file model_storage_v2.h.
|
inline |
Returns true if this id has been created and not yet deleted.
Definition at line 680 of file model_storage_v2.h.
|
inline |
Definition at line 761 of file model_storage_v2.h.
|
inline |
Definition at line 855 of file model_storage_v2.h.
|
inline |
Objectives
The primary ObjectiveId is PrimaryObjectiveId. All auxiliary objectives are referenced by their corresponding AuxiliaryObjectiveId.
Objectives
Definition at line 817 of file model_storage_v2.h.
|
inline |
The ordering of the input variables does not matter.
Definition at line 865 of file model_storage_v2.h.
|
inline |
Definition at line 635 of file model_storage_v2.h.
|
inline |
Returns 0.0 if the entry is not in matrix.
Linear constraint matrix
Linear Constraint Matrix
Definition at line 755 of file model_storage_v2.h.
|
inline |
Definition at line 704 of file model_storage_v2.h.
|
inline |
The {linear constraint, variable, coefficient} tuples with nonzero linear constraint matrix coefficients.
Definition at line 775 of file model_storage_v2.h.
|
inline |
Definition at line 714 of file model_storage_v2.h.
|
inline |
Definition at line 709 of file model_storage_v2.h.
|
inline |
Returns the linear constraints with nonzero coefficients on a variable.
Definition at line 799 of file model_storage_v2.h.
|
inline |
The variables with nonzero linear objective coefficients.
Definition at line 961 of file model_storage_v2.h.
|
inline |
Returns 0.0 if this variable has no linear objective coefficient.
Definition at line 836 of file model_storage_v2.h.
std::vector< LinearConstraintId > operations_research::math_opt::ModelStorageV2::LinearConstraints | ( | ) | const |
The LinearConstraintsIds in use (not deleted), order not defined.
Definition at line 110 of file model_storage_v2.cc.
std::vector< VariableId > operations_research::math_opt::ModelStorageV2::LinearObjectiveNonzeros | ( | ObjectiveId | id | ) | const |
Returns the variable ids where the objective has a nonzero linear objective coefficient in an arbitrary order.
Definition at line 98 of file model_storage_v2.cc.
|
inline |
Definition at line 112 of file model_storage_v2.h.
UpdateTrackerId operations_research::math_opt::ModelStorageV2::NewUpdateTracker | ( | ) |
Creates a tracker that can be used to generate a ModelUpdateProto with the updates that happened since the last checkpoint. The tracker initial checkpoint corresponds to the current state of the model.
Thread-safety: this method must not be used while modifying the ModelStorage. The user is expected to use proper synchronization primitive to serialize changes to the model and trackers creations. That said multiple trackers can be created concurrently.
For each update tracker we define a checkpoint that is the starting point used to compute the ModelUpdateProto.
Definition at line 125 of file model_storage_v2.cc.
|
inline |
The returned id of the next call to AddAuxiliaryObjective.
Equal to the number of auxiliary objectives created.
Definition at line 1017 of file model_storage_v2.h.
|
inline |
Returns the smallest valid ID for a new atomic constraint of the family corresponding to ConstraintData.
Definition at line 1101 of file model_storage_v2.h.
|
inline |
The returned id of the next call to AddLinearConstraint.
Equal to the number of linear constraints created.
Definition at line 735 of file model_storage_v2.h.
|
inline |
The returned id of the next call to AddVariable.
Equal to the number of variables created.
Definition at line 672 of file model_storage_v2.h.
|
inline |
The number of auxiliary objectives in the model.
Equal to the number of auxiliary objectives created minus the number of auxiliary objectives deleted.
Definition at line 1012 of file model_storage_v2.h.
|
inline |
Returns the number of atomic constraints in the model of the family corresponding to ConstraintData.
Equal to the number of such constraints created minus the number of such constraints deleted.
Definition at line 1092 of file model_storage_v2.h.
|
inline |
The number of linear constraints in the model.
Equal to the number of linear constraints created minus the number of linear constraints deleted.
Definition at line 731 of file model_storage_v2.h.
|
inline |
Definition at line 966 of file model_storage_v2.h.
|
inline |
Definition at line 974 of file model_storage_v2.h.
|
inline |
The number of variables in the model.
Equal to the number of variables created minus the number of variables deleted.
Definition at line 668 of file model_storage_v2.h.
|
inline |
Definition at line 875 of file model_storage_v2.h.
|
inline |
Definition at line 829 of file model_storage_v2.h.
|
inline |
Definition at line 823 of file model_storage_v2.h.
|
delete |
|
inline |
The ordering of the input variables does not matter.
Definition at line 845 of file model_storage_v2.h.
|
inline |
The variable pairs with nonzero quadratic objective coefficients. The keys are ordered such that .first <= .second. All values are nonempty.
Definition at line 981 of file model_storage_v2.h.
|
inline |
Definition at line 883 of file model_storage_v2.h.
|
inline |
Setting a value to 0.0 will delete the {constraint, variable} pair from the underlying sparse matrix representation (and has no effect if the pair is not present).
Definition at line 767 of file model_storage_v2.h.
|
inline |
Definition at line 721 of file model_storage_v2.h.
|
inline |
Definition at line 726 of file model_storage_v2.h.
|
inline |
Setting a value to 0.0 will delete the variable from the underlying sparse representation (and has no effect if the variable is not present).
Definition at line 919 of file model_storage_v2.h.
|
inline |
Definition at line 893 of file model_storage_v2.h.
|
inline |
Definition at line 897 of file model_storage_v2.h.
|
inline |
Definition at line 910 of file model_storage_v2.h.
|
inline |
Definition at line 901 of file model_storage_v2.h.
|
inline |
Setting a value to 0.0 will delete the variable pair from the underlying sparse representation (and has no effect if the pair is not present). The ordering of the input variables does not matter.
Definition at line 931 of file model_storage_v2.h.
|
inline |
Definition at line 664 of file model_storage_v2.h.
|
inline |
Definition at line 660 of file model_storage_v2.h.
|
inline |
Definition at line 655 of file model_storage_v2.h.
|
inline |
Definition at line 645 of file model_storage_v2.h.
|
inline |
Definition at line 650 of file model_storage_v2.h.
|
inline |
Returns a sorted vector of all existing (not deleted) auxiliary objectives in the model.
Runs in O(n log(n)), where n is the number of auxiliary objectives returned.
Definition at line 1042 of file model_storage_v2.h.
std::vector< IdType > operations_research::math_opt::ModelStorageV2::SortedConstraints | ( | ) | const |
Returns a sorted vector of all existing (not deleted) atomic constraints in the model of the family corresponding to ConstraintData.
Runs in O(n log(n)), where n is the number of constraints returned.
Definition at line 1145 of file model_storage_v2.h.
std::vector< LinearConstraintId > operations_research::math_opt::ModelStorageV2::SortedLinearConstraints | ( | ) | const |
Returns a sorted vector of all existing (not deleted) linear constraints in the model.
Runs in O(n log(n)), where n is the number of linear constraints returned.
Definition at line 115 of file model_storage_v2.cc.
std::vector< VariableId > operations_research::math_opt::ModelStorageV2::SortedVariables | ( | ) | const |
Returns a sorted vector of all existing (not deleted) variables in the model.
Runs in O(n log(n)), where n is the number of variables returned.
Definition at line 94 of file model_storage_v2.cc.
|
inline |
Definition at line 627 of file model_storage_v2.h.
|
inline |
Definition at line 639 of file model_storage_v2.h.
|
inline |
Definition at line 631 of file model_storage_v2.h.
std::vector< VariableId > operations_research::math_opt::ModelStorageV2::Variables | ( | ) | const |
The VariableIds in use (not deleted), order not defined.
Definition at line 90 of file model_storage_v2.cc.
|
inline |
Definition at line 169 of file model_storage_v2.h.
|
inline |
Returns the variables with nonzero coefficients in a linear constraint.
Definition at line 786 of file model_storage_v2.h.
|
inline |
Returns the variables appearing in the constraint. Order is not defined.
Definition at line 1162 of file model_storage_v2.h.