OR-Tools  9.6
LinearProgram

Detailed Description

Definition at line 56 of file lp_data.h.

Public Types

enum class  VariableType { CONTINUOUS , INTEGER , IMPLIED_INTEGER }
 

Public Member Functions

 LinearProgram ()
 
void Clear ()
 
void SetName (const std::string &name)
 
const std::string & name () const
 
ColIndex CreateNewVariable ()
 
ColIndex CreateNewSlackVariable (bool is_integer_slack_variable, Fractional lower_bound, Fractional upper_bound, const std::string &name)
 
RowIndex CreateNewConstraint ()
 
ColIndex FindOrCreateVariable (const std::string &variable_id)
 
RowIndex FindOrCreateConstraint (const std::string &constraint_id)
 
void SetVariableName (ColIndex col, absl::string_view name)
 
void SetConstraintName (RowIndex row, absl::string_view name)
 
void SetVariableType (ColIndex col, VariableType type)
 
bool IsVariableInteger (ColIndex col) const
 
bool IsVariableBinary (ColIndex col) const
 
void SetVariableBounds (ColIndex col, Fractional lower_bound, Fractional upper_bound)
 
void SetConstraintBounds (RowIndex row, Fractional lower_bound, Fractional upper_bound)
 
void SetCoefficient (RowIndex row, ColIndex col, Fractional value)
 
void SetObjectiveCoefficient (ColIndex col, Fractional value)
 
void SetObjectiveOffset (Fractional objective_offset)
 
void SetObjectiveScalingFactor (Fractional objective_scaling_factor)
 
void SetMaximizationProblem (bool maximize)
 
void CleanUp ()
 
bool IsCleanedUp () const
 
std::string GetVariableName (ColIndex col) const
 
std::string GetConstraintName (RowIndex row) const
 
VariableType GetVariableType (ColIndex col) const
 
bool IsMaximizationProblem () const
 
const SparseMatrixGetSparseMatrix () const
 
const SparseMatrixGetTransposeSparseMatrix () const
 
SparseMatrixGetMutableTransposeSparseMatrix ()
 
void UseTransposeMatrixAsReference ()
 
void ClearTransposeMatrix ()
 
const SparseColumnGetSparseColumn (ColIndex col) const
 
SparseColumnGetMutableSparseColumn (ColIndex col)
 
ColIndex num_variables () const
 
RowIndex num_constraints () const
 
EntryIndex num_entries () const
 
const DenseColumnconstraint_lower_bounds () const
 
const DenseColumnconstraint_upper_bounds () const
 
const DenseRowobjective_coefficients () const
 
const DenseRowvariable_lower_bounds () const
 
const DenseRowvariable_upper_bounds () const
 
const StrictITIVector< ColIndex, VariableTypevariable_types () const
 
const std::vector< ColIndex > & IntegerVariablesList () const
 
const std::vector< ColIndex > & BinaryVariablesList () const
 
const std::vector< ColIndex > & NonBinaryVariablesList () const
 
Fractional GetObjectiveCoefficientForMinimizationVersion (ColIndex col) const
 
Fractional objective_offset () const
 
Fractional objective_scaling_factor () const
 
bool SolutionIsWithinVariableBounds (const DenseRow &solution, Fractional absolute_tolerance) const
 
bool SolutionIsLPFeasible (const DenseRow &solution, Fractional absolute_tolerance) const
 
bool SolutionIsInteger (const DenseRow &solution, Fractional absolute_tolerance) const
 
bool SolutionIsMIPFeasible (const DenseRow &solution, Fractional absolute_tolerance) const
 
void ComputeSlackVariableValues (DenseRow *solution) const
 
Fractional ApplyObjectiveScalingAndOffset (Fractional value) const
 
Fractional RemoveObjectiveScalingAndOffset (Fractional value) const
 
std::string GetDimensionString () const
 
std::string GetObjectiveStatsString () const
 
std::string GetBoundsStatsString () const
 
std::string Dump () const
 
std::string DumpSolution (const DenseRow &variable_values) const
 
std::string GetProblemStats () const
 
std::string GetPrettyProblemStats () const
 
std::string GetNonZeroStats () const
 
std::string GetPrettyNonZeroStats () const
 
void AddSlackVariablesWhereNecessary (bool detect_integer_constraints)
 
ColIndex GetFirstSlackVariable () const
 
ColIndex GetSlackVariable (RowIndex row) const
 
void PopulateFromDual (const LinearProgram &dual, RowToColMapping *duplicated_rows)
 
void PopulateFromLinearProgram (const LinearProgram &linear_program)
 
void PopulateFromPermutedLinearProgram (const LinearProgram &lp, const RowPermutation &row_permutation, const ColumnPermutation &col_permutation)
 
void PopulateFromLinearProgramVariables (const LinearProgram &linear_program)
 
void AddConstraints (const SparseMatrix &coefficients, const DenseColumn &left_hand_sides, const DenseColumn &right_hand_sides, const StrictITIVector< RowIndex, std::string > &names)
 
void AddConstraintsWithSlackVariables (const SparseMatrix &coefficients, const DenseColumn &left_hand_sides, const DenseColumn &right_hand_sides, const StrictITIVector< RowIndex, std::string > &names, bool detect_integer_constraints_for_slack)
 
void Swap (LinearProgram *linear_program)
 
void DeleteColumns (const DenseBooleanRow &columns_to_delete)
 
void DeleteSlackVariables ()
 
void Scale (SparseMatrixScaler *scaler)
 
Fractional ScaleObjective (GlopParameters::CostScalingAlgorithm method)
 
Fractional ScaleBounds ()
 
void DeleteRows (const DenseBooleanColumn &rows_to_delete)
 
bool IsValid (Fractional max_valid_magnitude=kInfinity) const
 
bool UpdateVariableBoundsToIntersection (const DenseRow &variable_lower_bounds, const DenseRow &variable_upper_bounds)
 
bool IsInEquationForm () const
 
bool BoundsOfIntegerVariablesAreInteger (Fractional tolerance) const
 
bool BoundsOfIntegerConstraintsAreInteger (Fractional tolerance) const
 
void NotifyThatColumnsAreClean ()
 
void SetDcheckBounds (bool dcheck_bounds)
 
DenseColumnmutable_constraint_lower_bounds ()
 
DenseColumnmutable_constraint_upper_bounds ()
 

Member Enumeration Documentation

◆ VariableType

enum VariableType
strong
Enumerator
CONTINUOUS 
INTEGER 
IMPLIED_INTEGER 

Definition at line 58 of file lp_data.h.

Constructor & Destructor Documentation

◆ LinearProgram()

Definition at line 112 of file lp_data.cc.

Member Function Documentation

◆ AddConstraints()

void AddConstraints ( const SparseMatrix coefficients,
const DenseColumn left_hand_sides,
const DenseColumn right_hand_sides,
const StrictITIVector< RowIndex, std::string > &  names 
)

Definition at line 973 of file lp_data.cc.

◆ AddConstraintsWithSlackVariables()

void AddConstraintsWithSlackVariables ( const SparseMatrix coefficients,
const DenseColumn left_hand_sides,
const DenseColumn right_hand_sides,
const StrictITIVector< RowIndex, std::string > &  names,
bool  detect_integer_constraints_for_slack 
)

Definition at line 998 of file lp_data.cc.

◆ AddSlackVariablesWhereNecessary()

void AddSlackVariablesWhereNecessary ( bool  detect_integer_constraints)

Definition at line 698 of file lp_data.cc.

◆ ApplyObjectiveScalingAndOffset()

Fractional ApplyObjectiveScalingAndOffset ( Fractional  value) const

Definition at line 551 of file lp_data.cc.

◆ BinaryVariablesList()

const std::vector< ColIndex > & BinaryVariablesList ( ) const

Definition at line 286 of file lp_data.cc.

◆ BoundsOfIntegerConstraintsAreInteger()

bool BoundsOfIntegerConstraintsAreInteger ( Fractional  tolerance) const

Definition at line 1513 of file lp_data.cc.

◆ BoundsOfIntegerVariablesAreInteger()

bool BoundsOfIntegerVariablesAreInteger ( Fractional  tolerance) const

Definition at line 1497 of file lp_data.cc.

◆ CleanUp()

void CleanUp ( )

Definition at line 348 of file lp_data.cc.

◆ Clear()

void Clear ( )

Definition at line 135 of file lp_data.cc.

◆ ClearTransposeMatrix()

void ClearTransposeMatrix ( )

Definition at line 405 of file lp_data.cc.

◆ ComputeSlackVariableValues()

void ComputeSlackVariableValues ( DenseRow solution) const

Definition at line 536 of file lp_data.cc.

◆ constraint_lower_bounds()

const DenseColumn& constraint_lower_bounds ( ) const
inline

Definition at line 216 of file lp_data.h.

◆ constraint_upper_bounds()

const DenseColumn& constraint_upper_bounds ( ) const
inline

Definition at line 219 of file lp_data.h.

◆ CreateNewConstraint()

RowIndex CreateNewConstraint ( )

Definition at line 192 of file lp_data.cc.

◆ CreateNewSlackVariable()

ColIndex CreateNewSlackVariable ( bool  is_integer_slack_variable,
Fractional  lower_bound,
Fractional  upper_bound,
const std::string &  name 
)

Definition at line 177 of file lp_data.cc.

◆ CreateNewVariable()

ColIndex CreateNewVariable ( )

Definition at line 163 of file lp_data.cc.

◆ DeleteColumns()

void DeleteColumns ( const DenseBooleanRow columns_to_delete)

Definition at line 1066 of file lp_data.cc.

◆ DeleteRows()

void DeleteRows ( const DenseBooleanColumn rows_to_delete)

Definition at line 1259 of file lp_data.cc.

◆ DeleteSlackVariables()

void DeleteSlackVariables ( )

Definition at line 1115 of file lp_data.cc.

◆ Dump()

std::string Dump ( ) const

Definition at line 561 of file lp_data.cc.

◆ DumpSolution()

std::string DumpSolution ( const DenseRow variable_values) const

Definition at line 648 of file lp_data.cc.

◆ FindOrCreateConstraint()

RowIndex FindOrCreateConstraint ( const std::string &  constraint_id)

Definition at line 219 of file lp_data.cc.

◆ FindOrCreateVariable()

ColIndex FindOrCreateVariable ( const std::string &  variable_id)

Definition at line 206 of file lp_data.cc.

◆ GetBoundsStatsString()

std::string GetBoundsStatsString ( ) const

Definition at line 466 of file lp_data.cc.

◆ GetConstraintName()

std::string GetConstraintName ( RowIndex  row) const

Definition at line 367 of file lp_data.cc.

◆ GetDimensionString()

std::string GetDimensionString ( ) const

Definition at line 426 of file lp_data.cc.

◆ GetFirstSlackVariable()

ColIndex GetFirstSlackVariable ( ) const

Definition at line 752 of file lp_data.cc.

◆ GetMutableSparseColumn()

SparseColumn * GetMutableSparseColumn ( ColIndex  col)

Definition at line 414 of file lp_data.cc.

◆ GetMutableTransposeSparseMatrix()

SparseMatrix * GetMutableTransposeSparseMatrix ( )

Definition at line 387 of file lp_data.cc.

◆ GetNonZeroStats()

std::string GetNonZeroStats ( ) const

Definition at line 687 of file lp_data.cc.

◆ GetObjectiveCoefficientForMinimizationVersion()

Fractional GetObjectiveCoefficientForMinimizationVersion ( ColIndex  col) const

Definition at line 420 of file lp_data.cc.

◆ GetObjectiveStatsString()

std::string GetObjectiveStatsString ( ) const

Definition at line 453 of file lp_data.cc.

◆ GetPrettyNonZeroStats()

std::string GetPrettyNonZeroStats ( ) const

Definition at line 691 of file lp_data.cc.

◆ GetPrettyProblemStats()

std::string GetPrettyProblemStats ( ) const

Definition at line 665 of file lp_data.cc.

◆ GetProblemStats()

std::string GetProblemStats ( ) const

Definition at line 659 of file lp_data.cc.

◆ GetSlackVariable()

ColIndex GetSlackVariable ( RowIndex  row) const

Definition at line 756 of file lp_data.cc.

◆ GetSparseColumn()

const SparseColumn & GetSparseColumn ( ColIndex  col) const

Definition at line 410 of file lp_data.cc.

◆ GetSparseMatrix()

const SparseMatrix& GetSparseMatrix ( ) const
inline

Definition at line 176 of file lp_data.h.

◆ GetTransposeSparseMatrix()

const SparseMatrix & GetTransposeSparseMatrix ( ) const

Definition at line 377 of file lp_data.cc.

◆ GetVariableName()

std::string GetVariableName ( ColIndex  col) const

Definition at line 361 of file lp_data.cc.

◆ GetVariableType()

LinearProgram::VariableType GetVariableType ( ColIndex  col) const

Definition at line 373 of file lp_data.cc.

◆ IntegerVariablesList()

const std::vector< ColIndex > & IntegerVariablesList ( ) const

Definition at line 281 of file lp_data.cc.

◆ IsCleanedUp()

bool IsCleanedUp ( ) const

Definition at line 355 of file lp_data.cc.

◆ IsInEquationForm()

bool IsInEquationForm ( ) const

Definition at line 1484 of file lp_data.cc.

◆ IsMaximizationProblem()

bool IsMaximizationProblem ( ) const
inline

Definition at line 172 of file lp_data.h.

◆ IsValid()

bool IsValid ( Fractional  max_valid_magnitude = kInfinity) const

Definition at line 1306 of file lp_data.cc.

◆ IsVariableBinary()

bool IsVariableBinary ( ColIndex  col) const

Definition at line 301 of file lp_data.cc.

◆ IsVariableInteger()

bool IsVariableInteger ( ColIndex  col) const

Definition at line 296 of file lp_data.cc.

◆ mutable_constraint_lower_bounds()

DenseColumn* mutable_constraint_lower_bounds ( )
inline

Definition at line 554 of file lp_data.h.

◆ mutable_constraint_upper_bounds()

DenseColumn* mutable_constraint_upper_bounds ( )
inline

Definition at line 557 of file lp_data.h.

◆ name()

const std::string& name ( ) const
inline

Definition at line 76 of file lp_data.h.

◆ NonBinaryVariablesList()

const std::vector< ColIndex > & NonBinaryVariablesList ( ) const

Definition at line 291 of file lp_data.cc.

◆ NotifyThatColumnsAreClean()

void NotifyThatColumnsAreClean ( )
inline

Definition at line 544 of file lp_data.h.

◆ num_constraints()

RowIndex num_constraints ( ) const
inline

Definition at line 209 of file lp_data.h.

◆ num_entries()

EntryIndex num_entries ( ) const
inline

Definition at line 212 of file lp_data.h.

◆ num_variables()

ColIndex num_variables ( ) const
inline

Definition at line 206 of file lp_data.h.

◆ objective_coefficients()

const DenseRow& objective_coefficients ( ) const
inline

Definition at line 224 of file lp_data.h.

◆ objective_offset()

Fractional objective_offset ( ) const
inline

Definition at line 261 of file lp_data.h.

◆ objective_scaling_factor()

Fractional objective_scaling_factor ( ) const
inline

Definition at line 262 of file lp_data.h.

◆ PopulateFromDual()

void PopulateFromDual ( const LinearProgram dual,
RowToColMapping duplicated_rows 
)

Definition at line 765 of file lp_data.cc.

◆ PopulateFromLinearProgram()

void PopulateFromLinearProgram ( const LinearProgram linear_program)

Definition at line 863 of file lp_data.cc.

◆ PopulateFromLinearProgramVariables()

void PopulateFromLinearProgramVariables ( const LinearProgram linear_program)

Definition at line 936 of file lp_data.cc.

◆ PopulateFromPermutedLinearProgram()

void PopulateFromPermutedLinearProgram ( const LinearProgram lp,
const RowPermutation row_permutation,
const ColumnPermutation col_permutation 
)

Definition at line 884 of file lp_data.cc.

◆ RemoveObjectiveScalingAndOffset()

Fractional RemoveObjectiveScalingAndOffset ( Fractional  value) const

Definition at line 556 of file lp_data.cc.

◆ Scale()

void Scale ( SparseMatrixScaler scaler)

◆ ScaleBounds()

Fractional ScaleBounds ( )

Definition at line 1224 of file lp_data.cc.

◆ ScaleObjective()

Fractional ScaleObjective ( GlopParameters::CostScalingAlgorithm  method)

Definition at line 1189 of file lp_data.cc.

◆ SetCoefficient()

void SetCoefficient ( RowIndex  row,
ColIndex  col,
Fractional  value 
)

Definition at line 318 of file lp_data.cc.

◆ SetConstraintBounds()

void SetConstraintBounds ( RowIndex  row,
Fractional  lower_bound,
Fractional  upper_bound 
)

Definition at line 310 of file lp_data.cc.

◆ SetConstraintName()

void SetConstraintName ( RowIndex  row,
absl::string_view  name 
)

Definition at line 246 of file lp_data.cc.

◆ SetDcheckBounds()

void SetDcheckBounds ( bool  dcheck_bounds)
inline

Definition at line 550 of file lp_data.h.

◆ SetMaximizationProblem()

void SetMaximizationProblem ( bool  maximize)

Definition at line 344 of file lp_data.cc.

◆ SetName()

void SetName ( const std::string &  name)
inline

Definition at line 75 of file lp_data.h.

◆ SetObjectiveCoefficient()

void SetObjectiveCoefficient ( ColIndex  col,
Fractional  value 
)

Definition at line 327 of file lp_data.cc.

◆ SetObjectiveOffset()

void SetObjectiveOffset ( Fractional  objective_offset)

Definition at line 332 of file lp_data.cc.

◆ SetObjectiveScalingFactor()

void SetObjectiveScalingFactor ( Fractional  objective_scaling_factor)

Definition at line 337 of file lp_data.cc.

◆ SetVariableBounds()

void SetVariableBounds ( ColIndex  col,
Fractional  lower_bound,
Fractional  upper_bound 
)

Definition at line 250 of file lp_data.cc.

◆ SetVariableName()

void SetVariableName ( ColIndex  col,
absl::string_view  name 
)

Definition at line 233 of file lp_data.cc.

◆ SetVariableType()

void SetVariableType ( ColIndex  col,
VariableType  type 
)

Definition at line 237 of file lp_data.cc.

◆ SolutionIsInteger()

bool SolutionIsInteger ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 518 of file lp_data.cc.

◆ SolutionIsLPFeasible()

bool SolutionIsLPFeasible ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 498 of file lp_data.cc.

◆ SolutionIsMIPFeasible()

bool SolutionIsMIPFeasible ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 530 of file lp_data.cc.

◆ SolutionIsWithinVariableBounds()

bool SolutionIsWithinVariableBounds ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 482 of file lp_data.cc.

◆ Swap()

void Swap ( LinearProgram linear_program)

Definition at line 1032 of file lp_data.cc.

◆ UpdateVariableBoundsToIntersection()

bool UpdateVariableBoundsToIntersection ( const DenseRow variable_lower_bounds,
const DenseRow variable_upper_bounds 
)

Definition at line 1007 of file lp_data.cc.

◆ UseTransposeMatrixAsReference()

void UseTransposeMatrixAsReference ( )

Definition at line 398 of file lp_data.cc.

◆ variable_lower_bounds()

const DenseRow& variable_lower_bounds ( ) const
inline

Definition at line 230 of file lp_data.h.

◆ variable_types()

const StrictITIVector<ColIndex, VariableType> variable_types ( ) const
inline

Definition at line 238 of file lp_data.h.

◆ variable_upper_bounds()

const DenseRow& variable_upper_bounds ( ) const
inline

Definition at line 233 of file lp_data.h.


The documentation for this class was generated from the following files: