OR-Tools  8.2
LinearProgram

Detailed Description

Definition at line 54 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 () 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)
 

Member Enumeration Documentation

◆ VariableType

enum VariableType
strong
Enumerator
CONTINUOUS 
INTEGER 
IMPLIED_INTEGER 

Definition at line 56 of file lp_data.h.

Constructor & Destructor Documentation

◆ LinearProgram()

Definition at line 110 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 970 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 995 of file lp_data.cc.

◆ AddSlackVariablesWhereNecessary()

void AddSlackVariablesWhereNecessary ( bool  detect_integer_constraints)

Definition at line 695 of file lp_data.cc.

◆ ApplyObjectiveScalingAndOffset()

Fractional ApplyObjectiveScalingAndOffset ( Fractional  value) const

Definition at line 548 of file lp_data.cc.

◆ BinaryVariablesList()

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

Definition at line 284 of file lp_data.cc.

◆ BoundsOfIntegerConstraintsAreInteger()

bool BoundsOfIntegerConstraintsAreInteger ( Fractional  tolerance) const

Definition at line 1498 of file lp_data.cc.

◆ BoundsOfIntegerVariablesAreInteger()

bool BoundsOfIntegerVariablesAreInteger ( Fractional  tolerance) const

Definition at line 1482 of file lp_data.cc.

◆ CleanUp()

void CleanUp ( )

Definition at line 346 of file lp_data.cc.

◆ Clear()

void Clear ( )

Definition at line 133 of file lp_data.cc.

◆ ClearTransposeMatrix()

void ClearTransposeMatrix ( )

Definition at line 403 of file lp_data.cc.

◆ ComputeSlackVariableValues()

void ComputeSlackVariableValues ( DenseRow solution) const

Definition at line 533 of file lp_data.cc.

◆ constraint_lower_bounds()

const DenseColumn& constraint_lower_bounds ( ) const
inline

Definition at line 214 of file lp_data.h.

◆ constraint_upper_bounds()

const DenseColumn& constraint_upper_bounds ( ) const
inline

Definition at line 217 of file lp_data.h.

◆ CreateNewConstraint()

RowIndex CreateNewConstraint ( )

Definition at line 190 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 175 of file lp_data.cc.

◆ CreateNewVariable()

ColIndex CreateNewVariable ( )

Definition at line 161 of file lp_data.cc.

◆ DeleteColumns()

void DeleteColumns ( const DenseBooleanRow columns_to_delete)

Definition at line 1063 of file lp_data.cc.

◆ DeleteRows()

void DeleteRows ( const DenseBooleanColumn rows_to_delete)

Definition at line 1256 of file lp_data.cc.

◆ DeleteSlackVariables()

void DeleteSlackVariables ( )

Definition at line 1112 of file lp_data.cc.

◆ Dump()

std::string Dump ( ) const

Definition at line 558 of file lp_data.cc.

◆ DumpSolution()

std::string DumpSolution ( const DenseRow variable_values) const

Definition at line 645 of file lp_data.cc.

◆ FindOrCreateConstraint()

RowIndex FindOrCreateConstraint ( const std::string &  constraint_id)

Definition at line 217 of file lp_data.cc.

◆ FindOrCreateVariable()

ColIndex FindOrCreateVariable ( const std::string &  variable_id)

Definition at line 204 of file lp_data.cc.

◆ GetBoundsStatsString()

std::string GetBoundsStatsString ( ) const

Definition at line 463 of file lp_data.cc.

◆ GetConstraintName()

std::string GetConstraintName ( RowIndex  row) const

Definition at line 365 of file lp_data.cc.

◆ GetDimensionString()

std::string GetDimensionString ( ) const

Definition at line 424 of file lp_data.cc.

◆ GetFirstSlackVariable()

ColIndex GetFirstSlackVariable ( ) const

Definition at line 749 of file lp_data.cc.

◆ GetMutableSparseColumn()

SparseColumn * GetMutableSparseColumn ( ColIndex  col)

Definition at line 412 of file lp_data.cc.

◆ GetMutableTransposeSparseMatrix()

SparseMatrix * GetMutableTransposeSparseMatrix ( )

Definition at line 385 of file lp_data.cc.

◆ GetNonZeroStats()

std::string GetNonZeroStats ( ) const

Definition at line 684 of file lp_data.cc.

◆ GetObjectiveCoefficientForMinimizationVersion()

Fractional GetObjectiveCoefficientForMinimizationVersion ( ColIndex  col) const

Definition at line 418 of file lp_data.cc.

◆ GetObjectiveStatsString()

std::string GetObjectiveStatsString ( ) const

Definition at line 450 of file lp_data.cc.

◆ GetPrettyNonZeroStats()

std::string GetPrettyNonZeroStats ( ) const

Definition at line 688 of file lp_data.cc.

◆ GetPrettyProblemStats()

std::string GetPrettyProblemStats ( ) const

Definition at line 662 of file lp_data.cc.

◆ GetProblemStats()

std::string GetProblemStats ( ) const

Definition at line 656 of file lp_data.cc.

◆ GetSlackVariable()

ColIndex GetSlackVariable ( RowIndex  row) const

Definition at line 753 of file lp_data.cc.

◆ GetSparseColumn()

const SparseColumn & GetSparseColumn ( ColIndex  col) const

Definition at line 408 of file lp_data.cc.

◆ GetSparseMatrix()

const SparseMatrix& GetSparseMatrix ( ) const
inline

Definition at line 174 of file lp_data.h.

◆ GetTransposeSparseMatrix()

const SparseMatrix & GetTransposeSparseMatrix ( ) const

Definition at line 375 of file lp_data.cc.

◆ GetVariableName()

std::string GetVariableName ( ColIndex  col) const

Definition at line 359 of file lp_data.cc.

◆ GetVariableType()

LinearProgram::VariableType GetVariableType ( ColIndex  col) const

Definition at line 371 of file lp_data.cc.

◆ IntegerVariablesList()

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

Definition at line 279 of file lp_data.cc.

◆ IsCleanedUp()

bool IsCleanedUp ( ) const

Definition at line 353 of file lp_data.cc.

◆ IsInEquationForm()

bool IsInEquationForm ( ) const

Definition at line 1469 of file lp_data.cc.

◆ IsMaximizationProblem()

bool IsMaximizationProblem ( ) const
inline

Definition at line 170 of file lp_data.h.

◆ IsValid()

bool IsValid ( ) const

Definition at line 1303 of file lp_data.cc.

◆ IsVariableBinary()

bool IsVariableBinary ( ColIndex  col) const

Definition at line 299 of file lp_data.cc.

◆ IsVariableInteger()

bool IsVariableInteger ( ColIndex  col) const

Definition at line 294 of file lp_data.cc.

◆ name()

const std::string& name ( ) const
inline

Definition at line 74 of file lp_data.h.

◆ NonBinaryVariablesList()

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

Definition at line 289 of file lp_data.cc.

◆ NotifyThatColumnsAreClean()

void NotifyThatColumnsAreClean ( )
inline

Definition at line 539 of file lp_data.h.

◆ num_constraints()

RowIndex num_constraints ( ) const
inline

Definition at line 207 of file lp_data.h.

◆ num_entries()

EntryIndex num_entries ( ) const
inline

Definition at line 210 of file lp_data.h.

◆ num_variables()

ColIndex num_variables ( ) const
inline

Definition at line 204 of file lp_data.h.

◆ objective_coefficients()

const DenseRow& objective_coefficients ( ) const
inline

Definition at line 222 of file lp_data.h.

◆ objective_offset()

Fractional objective_offset ( ) const
inline

Definition at line 259 of file lp_data.h.

◆ objective_scaling_factor()

Fractional objective_scaling_factor ( ) const
inline

Definition at line 260 of file lp_data.h.

◆ PopulateFromDual()

void PopulateFromDual ( const LinearProgram dual,
RowToColMapping duplicated_rows 
)

Definition at line 762 of file lp_data.cc.

◆ PopulateFromLinearProgram()

void PopulateFromLinearProgram ( const LinearProgram linear_program)

Definition at line 860 of file lp_data.cc.

◆ PopulateFromLinearProgramVariables()

void PopulateFromLinearProgramVariables ( const LinearProgram linear_program)

Definition at line 933 of file lp_data.cc.

◆ PopulateFromPermutedLinearProgram()

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

Definition at line 881 of file lp_data.cc.

◆ RemoveObjectiveScalingAndOffset()

Fractional RemoveObjectiveScalingAndOffset ( Fractional  value) const

Definition at line 553 of file lp_data.cc.

◆ Scale()

void Scale ( SparseMatrixScaler scaler)

◆ ScaleBounds()

Fractional ScaleBounds ( )

Definition at line 1221 of file lp_data.cc.

◆ ScaleObjective()

Fractional ScaleObjective ( GlopParameters::CostScalingAlgorithm  method)

Definition at line 1186 of file lp_data.cc.

◆ SetCoefficient()

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

Definition at line 316 of file lp_data.cc.

◆ SetConstraintBounds()

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

Definition at line 308 of file lp_data.cc.

◆ SetConstraintName()

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

Definition at line 244 of file lp_data.cc.

◆ SetDcheckBounds()

void SetDcheckBounds ( bool  dcheck_bounds)
inline

Definition at line 545 of file lp_data.h.

◆ SetMaximizationProblem()

void SetMaximizationProblem ( bool  maximize)

Definition at line 342 of file lp_data.cc.

◆ SetName()

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

Definition at line 73 of file lp_data.h.

◆ SetObjectiveCoefficient()

void SetObjectiveCoefficient ( ColIndex  col,
Fractional  value 
)

Definition at line 325 of file lp_data.cc.

◆ SetObjectiveOffset()

void SetObjectiveOffset ( Fractional  objective_offset)

Definition at line 330 of file lp_data.cc.

◆ SetObjectiveScalingFactor()

void SetObjectiveScalingFactor ( Fractional  objective_scaling_factor)

Definition at line 335 of file lp_data.cc.

◆ SetVariableBounds()

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

Definition at line 248 of file lp_data.cc.

◆ SetVariableName()

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

Definition at line 231 of file lp_data.cc.

◆ SetVariableType()

void SetVariableType ( ColIndex  col,
VariableType  type 
)

Definition at line 235 of file lp_data.cc.

◆ SolutionIsInteger()

bool SolutionIsInteger ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 515 of file lp_data.cc.

◆ SolutionIsLPFeasible()

bool SolutionIsLPFeasible ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 495 of file lp_data.cc.

◆ SolutionIsMIPFeasible()

bool SolutionIsMIPFeasible ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 527 of file lp_data.cc.

◆ SolutionIsWithinVariableBounds()

bool SolutionIsWithinVariableBounds ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 479 of file lp_data.cc.

◆ Swap()

void Swap ( LinearProgram linear_program)

Definition at line 1029 of file lp_data.cc.

◆ UpdateVariableBoundsToIntersection()

bool UpdateVariableBoundsToIntersection ( const DenseRow variable_lower_bounds,
const DenseRow variable_upper_bounds 
)

Definition at line 1004 of file lp_data.cc.

◆ UseTransposeMatrixAsReference()

void UseTransposeMatrixAsReference ( )

Definition at line 396 of file lp_data.cc.

◆ variable_lower_bounds()

const DenseRow& variable_lower_bounds ( ) const
inline

Definition at line 228 of file lp_data.h.

◆ variable_types()

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

Definition at line 236 of file lp_data.h.

◆ variable_upper_bounds()

const DenseRow& variable_upper_bounds ( ) const
inline

Definition at line 231 of file lp_data.h.


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