OR-Tools  8.0
LinearProgram

Detailed Description

Definition at line 55 of file lp_data.h.

Public Types

enum  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, const std::string &name)
 
void SetConstraintName (RowIndex row, const std::string &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 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 ()
 
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 57 of file lp_data.h.

Constructor & Destructor Documentation

◆ LinearProgram()

Definition at line 109 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 941 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 966 of file lp_data.cc.

◆ AddSlackVariablesWhereNecessary()

void AddSlackVariablesWhereNecessary ( bool  detect_integer_constraints)

Definition at line 666 of file lp_data.cc.

◆ ApplyObjectiveScalingAndOffset()

Fractional ApplyObjectiveScalingAndOffset ( Fractional  value) const

Definition at line 519 of file lp_data.cc.

◆ BinaryVariablesList()

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

Definition at line 283 of file lp_data.cc.

◆ BoundsOfIntegerConstraintsAreInteger()

bool BoundsOfIntegerConstraintsAreInteger ( Fractional  tolerance) const

Definition at line 1432 of file lp_data.cc.

◆ BoundsOfIntegerVariablesAreInteger()

bool BoundsOfIntegerVariablesAreInteger ( Fractional  tolerance) const

Definition at line 1416 of file lp_data.cc.

◆ CleanUp()

void CleanUp ( )

Definition at line 345 of file lp_data.cc.

◆ Clear()

void Clear ( )

Definition at line 132 of file lp_data.cc.

◆ ClearTransposeMatrix()

void ClearTransposeMatrix ( )

Definition at line 402 of file lp_data.cc.

◆ ComputeSlackVariableValues()

void ComputeSlackVariableValues ( DenseRow solution) const

Definition at line 504 of file lp_data.cc.

◆ constraint_lower_bounds()

const DenseColumn& constraint_lower_bounds ( ) const
inline

Definition at line 215 of file lp_data.h.

◆ constraint_upper_bounds()

const DenseColumn& constraint_upper_bounds ( ) const
inline

Definition at line 218 of file lp_data.h.

◆ CreateNewConstraint()

RowIndex CreateNewConstraint ( )

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

◆ CreateNewVariable()

ColIndex CreateNewVariable ( )

Definition at line 160 of file lp_data.cc.

◆ DeleteColumns()

void DeleteColumns ( const DenseBooleanRow columns_to_delete)

Definition at line 1034 of file lp_data.cc.

◆ DeleteRows()

void DeleteRows ( const DenseBooleanColumn rows_to_delete)

Definition at line 1190 of file lp_data.cc.

◆ DeleteSlackVariables()

void DeleteSlackVariables ( )

Definition at line 1083 of file lp_data.cc.

◆ Dump()

std::string Dump ( ) const

Definition at line 529 of file lp_data.cc.

◆ DumpSolution()

std::string DumpSolution ( const DenseRow variable_values) const

Definition at line 616 of file lp_data.cc.

◆ FindOrCreateConstraint()

RowIndex FindOrCreateConstraint ( const std::string &  constraint_id)

Definition at line 216 of file lp_data.cc.

◆ FindOrCreateVariable()

ColIndex FindOrCreateVariable ( const std::string &  variable_id)

Definition at line 203 of file lp_data.cc.

◆ GetConstraintName()

std::string GetConstraintName ( RowIndex  row) const

Definition at line 364 of file lp_data.cc.

◆ GetDimensionString()

std::string GetDimensionString ( ) const

Definition at line 423 of file lp_data.cc.

◆ GetFirstSlackVariable()

ColIndex GetFirstSlackVariable ( ) const

Definition at line 720 of file lp_data.cc.

◆ GetMutableSparseColumn()

SparseColumn * GetMutableSparseColumn ( ColIndex  col)

Definition at line 411 of file lp_data.cc.

◆ GetMutableTransposeSparseMatrix()

SparseMatrix * GetMutableTransposeSparseMatrix ( )

Definition at line 384 of file lp_data.cc.

◆ GetNonZeroStats()

std::string GetNonZeroStats ( ) const

Definition at line 655 of file lp_data.cc.

◆ GetObjectiveCoefficientForMinimizationVersion()

Fractional GetObjectiveCoefficientForMinimizationVersion ( ColIndex  col) const

Definition at line 417 of file lp_data.cc.

◆ GetObjectiveStatsString()

std::string GetObjectiveStatsString ( ) const

Definition at line 431 of file lp_data.cc.

◆ GetPrettyNonZeroStats()

std::string GetPrettyNonZeroStats ( ) const

Definition at line 659 of file lp_data.cc.

◆ GetPrettyProblemStats()

std::string GetPrettyProblemStats ( ) const

Definition at line 633 of file lp_data.cc.

◆ GetProblemStats()

std::string GetProblemStats ( ) const

Definition at line 627 of file lp_data.cc.

◆ GetSlackVariable()

ColIndex GetSlackVariable ( RowIndex  row) const

Definition at line 724 of file lp_data.cc.

◆ GetSparseColumn()

const SparseColumn & GetSparseColumn ( ColIndex  col) const

Definition at line 407 of file lp_data.cc.

◆ GetSparseMatrix()

const SparseMatrix& GetSparseMatrix ( ) const
inline

Definition at line 175 of file lp_data.h.

◆ GetTransposeSparseMatrix()

const SparseMatrix & GetTransposeSparseMatrix ( ) const

Definition at line 374 of file lp_data.cc.

◆ GetVariableName()

std::string GetVariableName ( ColIndex  col) const

Definition at line 358 of file lp_data.cc.

◆ GetVariableType()

LinearProgram::VariableType GetVariableType ( ColIndex  col) const

Definition at line 370 of file lp_data.cc.

◆ IntegerVariablesList()

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

Definition at line 278 of file lp_data.cc.

◆ IsCleanedUp()

bool IsCleanedUp ( ) const

Definition at line 352 of file lp_data.cc.

◆ IsInEquationForm()

bool IsInEquationForm ( ) const

Definition at line 1403 of file lp_data.cc.

◆ IsMaximizationProblem()

bool IsMaximizationProblem ( ) const
inline

Definition at line 171 of file lp_data.h.

◆ IsValid()

bool IsValid ( ) const

Definition at line 1237 of file lp_data.cc.

◆ IsVariableBinary()

bool IsVariableBinary ( ColIndex  col) const

Definition at line 298 of file lp_data.cc.

◆ IsVariableInteger()

bool IsVariableInteger ( ColIndex  col) const

Definition at line 293 of file lp_data.cc.

◆ name()

const std::string& name ( ) const
inline

Definition at line 75 of file lp_data.h.

◆ NonBinaryVariablesList()

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

Definition at line 288 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 208 of file lp_data.h.

◆ num_entries()

EntryIndex num_entries ( ) const
inline

Definition at line 211 of file lp_data.h.

◆ num_variables()

ColIndex num_variables ( ) const
inline

Definition at line 205 of file lp_data.h.

◆ objective_coefficients()

const DenseRow& objective_coefficients ( ) const
inline

Definition at line 223 of file lp_data.h.

◆ objective_offset()

Fractional objective_offset ( ) const
inline

Definition at line 260 of file lp_data.h.

◆ objective_scaling_factor()

Fractional objective_scaling_factor ( ) const
inline

Definition at line 261 of file lp_data.h.

◆ PopulateFromDual()

void PopulateFromDual ( const LinearProgram dual,
RowToColMapping duplicated_rows 
)

Definition at line 733 of file lp_data.cc.

◆ PopulateFromLinearProgram()

void PopulateFromLinearProgram ( const LinearProgram linear_program)

Definition at line 831 of file lp_data.cc.

◆ PopulateFromLinearProgramVariables()

void PopulateFromLinearProgramVariables ( const LinearProgram linear_program)

Definition at line 904 of file lp_data.cc.

◆ PopulateFromPermutedLinearProgram()

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

Definition at line 852 of file lp_data.cc.

◆ RemoveObjectiveScalingAndOffset()

Fractional RemoveObjectiveScalingAndOffset ( Fractional  value) const

Definition at line 524 of file lp_data.cc.

◆ Scale()

void Scale ( SparseMatrixScaler scaler)

◆ ScaleBounds()

Fractional ScaleBounds ( )

Definition at line 1155 of file lp_data.cc.

◆ ScaleObjective()

Fractional ScaleObjective ( )

Definition at line 1134 of file lp_data.cc.

◆ SetCoefficient()

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

Definition at line 315 of file lp_data.cc.

◆ SetConstraintBounds()

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

Definition at line 307 of file lp_data.cc.

◆ SetConstraintName()

void SetConstraintName ( RowIndex  row,
const std::string &  name 
)

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

◆ SetName()

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

Definition at line 74 of file lp_data.h.

◆ SetObjectiveCoefficient()

void SetObjectiveCoefficient ( ColIndex  col,
Fractional  value 
)

Definition at line 324 of file lp_data.cc.

◆ SetObjectiveOffset()

void SetObjectiveOffset ( Fractional  objective_offset)

Definition at line 329 of file lp_data.cc.

◆ SetObjectiveScalingFactor()

void SetObjectiveScalingFactor ( Fractional  objective_scaling_factor)

Definition at line 334 of file lp_data.cc.

◆ SetVariableBounds()

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

Definition at line 247 of file lp_data.cc.

◆ SetVariableName()

void SetVariableName ( ColIndex  col,
const std::string &  name 
)

Definition at line 230 of file lp_data.cc.

◆ SetVariableType()

void SetVariableType ( ColIndex  col,
VariableType  type 
)

Definition at line 234 of file lp_data.cc.

◆ SolutionIsInteger()

bool SolutionIsInteger ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 486 of file lp_data.cc.

◆ SolutionIsLPFeasible()

bool SolutionIsLPFeasible ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 466 of file lp_data.cc.

◆ SolutionIsMIPFeasible()

bool SolutionIsMIPFeasible ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 498 of file lp_data.cc.

◆ SolutionIsWithinVariableBounds()

bool SolutionIsWithinVariableBounds ( const DenseRow solution,
Fractional  absolute_tolerance 
) const

Definition at line 450 of file lp_data.cc.

◆ Swap()

void Swap ( LinearProgram linear_program)

Definition at line 1000 of file lp_data.cc.

◆ UpdateVariableBoundsToIntersection()

bool UpdateVariableBoundsToIntersection ( const DenseRow variable_lower_bounds,
const DenseRow variable_upper_bounds 
)

Definition at line 975 of file lp_data.cc.

◆ UseTransposeMatrixAsReference()

void UseTransposeMatrixAsReference ( )

Definition at line 395 of file lp_data.cc.

◆ variable_lower_bounds()

const DenseRow& variable_lower_bounds ( ) const
inline

Definition at line 229 of file lp_data.h.

◆ variable_types()

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

Definition at line 237 of file lp_data.h.

◆ variable_upper_bounds()

const DenseRow& variable_upper_bounds ( ) const
inline

Definition at line 232 of file lp_data.h.


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