Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::lp_format Namespace Reference

Classes

struct  Constraint
 
class  LpModel
 

Typedefs

using Term = std::pair<double, VariableIndex>
 

Enumerations

enum class  Relation { kLessOrEqual , kGreaterOrEqual , kEqual }
 

Functions

std::ostream & operator<< (std::ostream &ostr, const Relation relation)
 
std::ostream & operator<< (std::ostream &ostr, const Constraint &constraint)
 
std::ostream & operator<< (std::ostream &ostr, const LpModel &model)
 Prints the model in LP format to ostr.
 
 DEFINE_STRONG_INT_TYPE (VariableIndex, int64_t)
 
 DEFINE_STRONG_INT_TYPE (ConstraintIndex, int64_t)
 
bool ValidateCharInName (unsigned char c, bool leading)
 
absl::Status ValidateName (absl::string_view name)
 Checks if name is a valid name for a variable or constraint in an LP file.
 
LpModel RemoveUnusedVariables (const LpModel &model)
 
absl::StatusOr< LpModelPermuteVariables (const LpModel &model, const util_intops::StrongVector< VariableIndex, VariableIndex > &new_index_to_old_index)
 
absl::StatusOr< LpModelPermuteVariables (const LpModel &model, const util_intops::StrongVector< VariableIndex, std::string > &order_by_name)
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Typedef Documentation

◆ Term

using operations_research::lp_format::Term = std::pair<double, VariableIndex>

Definition at line 29 of file lp_model.h.

Enumeration Type Documentation

◆ Relation

Enumerator
kLessOrEqual 
kGreaterOrEqual 
kEqual 

Definition at line 30 of file lp_model.h.

Function Documentation

◆ DEFINE_STRONG_INT_TYPE() [1/2]

operations_research::lp_format::DEFINE_STRONG_INT_TYPE ( ConstraintIndex ,
int64_t  )

◆ DEFINE_STRONG_INT_TYPE() [2/2]

operations_research::lp_format::DEFINE_STRONG_INT_TYPE ( VariableIndex ,
int64_t  )

◆ operator<<() [1/3]

std::ostream & operations_research::lp_format::operator<< ( std::ostream & ostr,
const Constraint & constraint )
Note
this prints an exact representation of the data in Constraint, not the string form of the constraint in LP format.

Definition at line 64 of file lp_model.cc.

◆ operator<<() [2/3]

std::ostream & operations_research::lp_format::operator<< ( std::ostream & ostr,
const LpModel & model )

Prints the model in LP format to ostr.

Definition at line 118 of file lp_model.cc.

◆ operator<<() [3/3]

std::ostream & operations_research::lp_format::operator<< ( std::ostream & ostr,
const Relation relation )

Definition at line 48 of file lp_model.cc.

◆ PermuteVariables() [1/2]

absl::StatusOr< LpModel > operations_research::lp_format::PermuteVariables ( const LpModel & model,
const util_intops::StrongVector< VariableIndex, std::string > & order_by_name )

Returns a copy of model where the variables are reordered by order_by_name, where order_by_name contains the name of each variable exactly one time, giving the new ordering.

Returns an error if order_by_name does not contain the name each variable in the model exactly once.

Note
because the variables are re-indexed, the constraints will have different values in terms.

Definition at line 111 of file model_utils.cc.

◆ PermuteVariables() [2/2]

absl::StatusOr< LpModel > operations_research::lp_format::PermuteVariables ( const LpModel & model,
const util_intops::StrongVector< VariableIndex, VariableIndex > & new_index_to_old_index )

Returns a copy of model where the variables are permuted by new_index_to_old_index (a permutation of the indices of the variables).

Returns an error if new_index_to_old_index is not a valid permutation.

Note
because the variables are re-indexed, the constraints will have different values in terms.

Definition at line 103 of file model_utils.cc.

◆ RemoveUnusedVariables()

LpModel operations_research::lp_format::RemoveUnusedVariables ( const LpModel & model)

Returns a copy of model, but where the variables appearing in no constraint have been deleted (and variable order is otherwise preserved).

Note
because the variables are re-indexed, the constraints will have different values in terms.

Definition at line 84 of file model_utils.cc.

◆ ValidateCharInName()

bool operations_research::lp_format::ValidateCharInName ( unsigned char c,
bool is_leading )

Returns true if c is valid character to be included the name of a variable or constraint in an LP file, where is_leading indicates if c is the first character of the name.

Definition at line 23 of file lp_name.cc.

◆ ValidateName()

absl::Status operations_research::lp_format::ValidateName ( absl::string_view name)

Checks if name is a valid name for a variable or constraint in an LP file.

Definition at line 57 of file lp_name.cc.