Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::glop::LinearProgram Class Reference

Detailed Description

Definition at line 58 of file lp_data.h.

#include <lp_data.h>

Public Types

enum class  VariableType { CONTINUOUS , INTEGER , IMPLIED_INTEGER }

Public Member Functions

 LinearProgram ()
 LinearProgram (const LinearProgram &)=delete
LinearProgram & operator= (const LinearProgram &)=delete
void Clear ()
void SetName (absl::string_view 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 (absl::string_view variable_id)
RowIndex FindOrCreateConstraint (absl::string_view 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 SparseMatrix & GetSparseMatrix () const
const SparseMatrix & GetTransposeSparseMatrix () const
SparseMatrix * GetMutableTransposeSparseMatrix ()
void UseTransposeMatrixAsReference ()
void ClearTransposeMatrix ()
const SparseColumn & GetSparseColumn (ColIndex col) const
SparseColumn * GetMutableSparseColumn (ColIndex col)
ColIndex num_variables () const
RowIndex num_constraints () const
EntryIndex num_entries () const
const DenseColumn & constraint_lower_bounds () const
const DenseColumn & constraint_upper_bounds () const
const DenseRow & objective_coefficients () const
const DenseRow & variable_lower_bounds () const
const DenseRow & variable_upper_bounds () const
StrictITIVector< ColIndex, VariableType > variable_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)
DenseColumn * mutable_constraint_lower_bounds ()
DenseColumn * mutable_constraint_upper_bounds ()
void RemoveNearZeroEntries (Fractional threshold)

Friends

void Scale (LinearProgram *lp, SparseMatrixScaler *scaler, GlopParameters::ScalingAlgorithm scaling_method)

Member Enumeration Documentation

◆ VariableType

Enumerator
CONTINUOUS 
INTEGER 
IMPLIED_INTEGER 

Definition at line 60 of file lp_data.h.

Constructor & Destructor Documentation

◆ LinearProgram() [1/2]

operations_research::glop::LinearProgram::LinearProgram ( )

Definition at line 120 of file lp_data.cc.

◆ LinearProgram() [2/2]

operations_research::glop::LinearProgram::LinearProgram ( const LinearProgram & )
delete

Member Function Documentation

◆ AddConstraints()

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

Definition at line 983 of file lp_data.cc.

◆ AddConstraintsWithSlackVariables()

void operations_research::glop::LinearProgram::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 1008 of file lp_data.cc.

◆ AddSlackVariablesWhereNecessary()

void operations_research::glop::LinearProgram::AddSlackVariablesWhereNecessary ( bool detect_integer_constraints)

Definition at line 708 of file lp_data.cc.

◆ ApplyObjectiveScalingAndOffset()

Fractional operations_research::glop::LinearProgram::ApplyObjectiveScalingAndOffset ( Fractional value) const

Definition at line 559 of file lp_data.cc.

◆ BinaryVariablesList()

const std::vector< ColIndex > & operations_research::glop::LinearProgram::BinaryVariablesList ( ) const

Definition at line 294 of file lp_data.cc.

◆ BoundsOfIntegerConstraintsAreInteger()

bool operations_research::glop::LinearProgram::BoundsOfIntegerConstraintsAreInteger ( Fractional tolerance) const

Definition at line 1523 of file lp_data.cc.

◆ BoundsOfIntegerVariablesAreInteger()

bool operations_research::glop::LinearProgram::BoundsOfIntegerVariablesAreInteger ( Fractional tolerance) const

Definition at line 1507 of file lp_data.cc.

◆ CleanUp()

void operations_research::glop::LinearProgram::CleanUp ( )

Definition at line 356 of file lp_data.cc.

◆ Clear()

void operations_research::glop::LinearProgram::Clear ( )

Definition at line 143 of file lp_data.cc.

◆ ClearTransposeMatrix()

void operations_research::glop::LinearProgram::ClearTransposeMatrix ( )

Definition at line 413 of file lp_data.cc.

◆ ComputeSlackVariableValues()

void operations_research::glop::LinearProgram::ComputeSlackVariableValues ( DenseRow * solution) const

Definition at line 544 of file lp_data.cc.

◆ constraint_lower_bounds()

const DenseColumn & operations_research::glop::LinearProgram::constraint_lower_bounds ( ) const
inline

Definition at line 222 of file lp_data.h.

◆ constraint_upper_bounds()

const DenseColumn & operations_research::glop::LinearProgram::constraint_upper_bounds ( ) const
inline

Definition at line 225 of file lp_data.h.

◆ CreateNewConstraint()

RowIndex operations_research::glop::LinearProgram::CreateNewConstraint ( )

Definition at line 200 of file lp_data.cc.

◆ CreateNewSlackVariable()

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

Definition at line 185 of file lp_data.cc.

◆ CreateNewVariable()

ColIndex operations_research::glop::LinearProgram::CreateNewVariable ( )

Definition at line 171 of file lp_data.cc.

◆ DeleteColumns()

void operations_research::glop::LinearProgram::DeleteColumns ( const DenseBooleanRow & columns_to_delete)

Definition at line 1076 of file lp_data.cc.

◆ DeleteRows()

void operations_research::glop::LinearProgram::DeleteRows ( const DenseBooleanColumn & rows_to_delete)

Definition at line 1269 of file lp_data.cc.

◆ DeleteSlackVariables()

void operations_research::glop::LinearProgram::DeleteSlackVariables ( )

Definition at line 1125 of file lp_data.cc.

◆ Dump()

std::string operations_research::glop::LinearProgram::Dump ( ) const

Definition at line 569 of file lp_data.cc.

◆ DumpSolution()

std::string operations_research::glop::LinearProgram::DumpSolution ( const DenseRow & variable_values) const

Definition at line 658 of file lp_data.cc.

◆ FindOrCreateConstraint()

RowIndex operations_research::glop::LinearProgram::FindOrCreateConstraint ( absl::string_view constraint_id)

Definition at line 227 of file lp_data.cc.

◆ FindOrCreateVariable()

ColIndex operations_research::glop::LinearProgram::FindOrCreateVariable ( absl::string_view variable_id)

Definition at line 214 of file lp_data.cc.

◆ GetBoundsStatsString()

std::string operations_research::glop::LinearProgram::GetBoundsStatsString ( ) const

Definition at line 474 of file lp_data.cc.

◆ GetConstraintName()

std::string operations_research::glop::LinearProgram::GetConstraintName ( RowIndex row) const

Definition at line 375 of file lp_data.cc.

◆ GetDimensionString()

std::string operations_research::glop::LinearProgram::GetDimensionString ( ) const

Definition at line 434 of file lp_data.cc.

◆ GetFirstSlackVariable()

ColIndex operations_research::glop::LinearProgram::GetFirstSlackVariable ( ) const

Definition at line 762 of file lp_data.cc.

◆ GetMutableSparseColumn()

SparseColumn * operations_research::glop::LinearProgram::GetMutableSparseColumn ( ColIndex col)

Definition at line 422 of file lp_data.cc.

◆ GetMutableTransposeSparseMatrix()

SparseMatrix * operations_research::glop::LinearProgram::GetMutableTransposeSparseMatrix ( )

Definition at line 395 of file lp_data.cc.

◆ GetNonZeroStats()

std::string operations_research::glop::LinearProgram::GetNonZeroStats ( ) const

Definition at line 697 of file lp_data.cc.

◆ GetObjectiveCoefficientForMinimizationVersion()

Fractional operations_research::glop::LinearProgram::GetObjectiveCoefficientForMinimizationVersion ( ColIndex col) const

Definition at line 428 of file lp_data.cc.

◆ GetObjectiveStatsString()

std::string operations_research::glop::LinearProgram::GetObjectiveStatsString ( ) const

Definition at line 461 of file lp_data.cc.

◆ GetPrettyNonZeroStats()

std::string operations_research::glop::LinearProgram::GetPrettyNonZeroStats ( ) const

Definition at line 701 of file lp_data.cc.

◆ GetPrettyProblemStats()

std::string operations_research::glop::LinearProgram::GetPrettyProblemStats ( ) const

Definition at line 675 of file lp_data.cc.

◆ GetProblemStats()

std::string operations_research::glop::LinearProgram::GetProblemStats ( ) const

Definition at line 669 of file lp_data.cc.

◆ GetSlackVariable()

ColIndex operations_research::glop::LinearProgram::GetSlackVariable ( RowIndex row) const

Definition at line 766 of file lp_data.cc.

◆ GetSparseColumn()

const SparseColumn & operations_research::glop::LinearProgram::GetSparseColumn ( ColIndex col) const

Definition at line 418 of file lp_data.cc.

◆ GetSparseMatrix()

const SparseMatrix & operations_research::glop::LinearProgram::GetSparseMatrix ( ) const
inline

Definition at line 182 of file lp_data.h.

◆ GetTransposeSparseMatrix()

const SparseMatrix & operations_research::glop::LinearProgram::GetTransposeSparseMatrix ( ) const

Definition at line 385 of file lp_data.cc.

◆ GetVariableName()

std::string operations_research::glop::LinearProgram::GetVariableName ( ColIndex col) const

Definition at line 369 of file lp_data.cc.

◆ GetVariableType()

LinearProgram::VariableType operations_research::glop::LinearProgram::GetVariableType ( ColIndex col) const

Definition at line 381 of file lp_data.cc.

◆ IntegerVariablesList()

const std::vector< ColIndex > & operations_research::glop::LinearProgram::IntegerVariablesList ( ) const

Definition at line 289 of file lp_data.cc.

◆ IsCleanedUp()

bool operations_research::glop::LinearProgram::IsCleanedUp ( ) const

Definition at line 363 of file lp_data.cc.

◆ IsInEquationForm()

bool operations_research::glop::LinearProgram::IsInEquationForm ( ) const

Definition at line 1494 of file lp_data.cc.

◆ IsMaximizationProblem()

bool operations_research::glop::LinearProgram::IsMaximizationProblem ( ) const
inline

Definition at line 178 of file lp_data.h.

◆ IsValid()

bool operations_research::glop::LinearProgram::IsValid ( Fractional max_valid_magnitude = kInfinity) const

Definition at line 1316 of file lp_data.cc.

◆ IsVariableBinary()

bool operations_research::glop::LinearProgram::IsVariableBinary ( ColIndex col) const

Definition at line 309 of file lp_data.cc.

◆ IsVariableInteger()

bool operations_research::glop::LinearProgram::IsVariableInteger ( ColIndex col) const

Definition at line 304 of file lp_data.cc.

◆ mutable_constraint_lower_bounds()

DenseColumn * operations_research::glop::LinearProgram::mutable_constraint_lower_bounds ( )
inline

Definition at line 560 of file lp_data.h.

◆ mutable_constraint_upper_bounds()

DenseColumn * operations_research::glop::LinearProgram::mutable_constraint_upper_bounds ( )
inline

Definition at line 563 of file lp_data.h.

◆ name()

const std::string & operations_research::glop::LinearProgram::name ( ) const
inline

Definition at line 82 of file lp_data.h.

◆ NonBinaryVariablesList()

const std::vector< ColIndex > & operations_research::glop::LinearProgram::NonBinaryVariablesList ( ) const

Definition at line 299 of file lp_data.cc.

◆ NotifyThatColumnsAreClean()

void operations_research::glop::LinearProgram::NotifyThatColumnsAreClean ( )
inline

Definition at line 550 of file lp_data.h.

◆ num_constraints()

RowIndex operations_research::glop::LinearProgram::num_constraints ( ) const
inline

Definition at line 215 of file lp_data.h.

◆ num_entries()

EntryIndex operations_research::glop::LinearProgram::num_entries ( ) const
inline

Definition at line 218 of file lp_data.h.

◆ num_variables()

ColIndex operations_research::glop::LinearProgram::num_variables ( ) const
inline

Definition at line 212 of file lp_data.h.

◆ objective_coefficients()

const DenseRow & operations_research::glop::LinearProgram::objective_coefficients ( ) const
inline

Definition at line 230 of file lp_data.h.

◆ objective_offset()

Fractional operations_research::glop::LinearProgram::objective_offset ( ) const
inline

Definition at line 267 of file lp_data.h.

◆ objective_scaling_factor()

Fractional operations_research::glop::LinearProgram::objective_scaling_factor ( ) const
inline

Definition at line 268 of file lp_data.h.

◆ operator=()

LinearProgram & operations_research::glop::LinearProgram::operator= ( const LinearProgram & )
delete

◆ PopulateFromDual()

void operations_research::glop::LinearProgram::PopulateFromDual ( const LinearProgram & dual,
RowToColMapping * duplicated_rows )

Definition at line 775 of file lp_data.cc.

◆ PopulateFromLinearProgram()

void operations_research::glop::LinearProgram::PopulateFromLinearProgram ( const LinearProgram & linear_program)

Definition at line 873 of file lp_data.cc.

◆ PopulateFromLinearProgramVariables()

void operations_research::glop::LinearProgram::PopulateFromLinearProgramVariables ( const LinearProgram & linear_program)

Definition at line 946 of file lp_data.cc.

◆ PopulateFromPermutedLinearProgram()

void operations_research::glop::LinearProgram::PopulateFromPermutedLinearProgram ( const LinearProgram & lp,
const RowPermutation & row_permutation,
const ColumnPermutation & col_permutation )

Definition at line 894 of file lp_data.cc.

◆ RemoveNearZeroEntries()

void operations_research::glop::LinearProgram::RemoveNearZeroEntries ( Fractional threshold)

Definition at line 1561 of file lp_data.cc.

◆ RemoveObjectiveScalingAndOffset()

Fractional operations_research::glop::LinearProgram::RemoveObjectiveScalingAndOffset ( Fractional value) const

Definition at line 564 of file lp_data.cc.

◆ Scale()

void operations_research::glop::LinearProgram::Scale ( SparseMatrixScaler * scaler)

◆ ScaleBounds()

Fractional operations_research::glop::LinearProgram::ScaleBounds ( )

Definition at line 1234 of file lp_data.cc.

◆ ScaleObjective()

Fractional operations_research::glop::LinearProgram::ScaleObjective ( GlopParameters::CostScalingAlgorithm method)

Definition at line 1199 of file lp_data.cc.

◆ SetCoefficient()

void operations_research::glop::LinearProgram::SetCoefficient ( RowIndex row,
ColIndex col,
Fractional value )

Definition at line 326 of file lp_data.cc.

◆ SetConstraintBounds()

void operations_research::glop::LinearProgram::SetConstraintBounds ( RowIndex row,
Fractional lower_bound,
Fractional upper_bound )

Definition at line 318 of file lp_data.cc.

◆ SetConstraintName()

void operations_research::glop::LinearProgram::SetConstraintName ( RowIndex row,
absl::string_view name )

Definition at line 254 of file lp_data.cc.

◆ SetDcheckBounds()

void operations_research::glop::LinearProgram::SetDcheckBounds ( bool dcheck_bounds)
inline

Definition at line 556 of file lp_data.h.

◆ SetMaximizationProblem()

void operations_research::glop::LinearProgram::SetMaximizationProblem ( bool maximize)

Definition at line 352 of file lp_data.cc.

◆ SetName()

void operations_research::glop::LinearProgram::SetName ( absl::string_view name)
inline

Definition at line 81 of file lp_data.h.

◆ SetObjectiveCoefficient()

void operations_research::glop::LinearProgram::SetObjectiveCoefficient ( ColIndex col,
Fractional value )

Definition at line 335 of file lp_data.cc.

◆ SetObjectiveOffset()

void operations_research::glop::LinearProgram::SetObjectiveOffset ( Fractional objective_offset)

Definition at line 340 of file lp_data.cc.

◆ SetObjectiveScalingFactor()

void operations_research::glop::LinearProgram::SetObjectiveScalingFactor ( Fractional objective_scaling_factor)

Definition at line 345 of file lp_data.cc.

◆ SetVariableBounds()

void operations_research::glop::LinearProgram::SetVariableBounds ( ColIndex col,
Fractional lower_bound,
Fractional upper_bound )

Definition at line 258 of file lp_data.cc.

◆ SetVariableName()

void operations_research::glop::LinearProgram::SetVariableName ( ColIndex col,
absl::string_view name )

Definition at line 241 of file lp_data.cc.

◆ SetVariableType()

void operations_research::glop::LinearProgram::SetVariableType ( ColIndex col,
VariableType type )

Definition at line 245 of file lp_data.cc.

◆ SolutionIsInteger()

bool operations_research::glop::LinearProgram::SolutionIsInteger ( const DenseRow & solution,
Fractional absolute_tolerance ) const

Definition at line 526 of file lp_data.cc.

◆ SolutionIsLPFeasible()

bool operations_research::glop::LinearProgram::SolutionIsLPFeasible ( const DenseRow & solution,
Fractional absolute_tolerance ) const

Definition at line 506 of file lp_data.cc.

◆ SolutionIsMIPFeasible()

bool operations_research::glop::LinearProgram::SolutionIsMIPFeasible ( const DenseRow & solution,
Fractional absolute_tolerance ) const

Definition at line 538 of file lp_data.cc.

◆ SolutionIsWithinVariableBounds()

bool operations_research::glop::LinearProgram::SolutionIsWithinVariableBounds ( const DenseRow & solution,
Fractional absolute_tolerance ) const

Definition at line 490 of file lp_data.cc.

◆ Swap()

void operations_research::glop::LinearProgram::Swap ( LinearProgram * linear_program)

Definition at line 1042 of file lp_data.cc.

◆ UpdateVariableBoundsToIntersection()

bool operations_research::glop::LinearProgram::UpdateVariableBoundsToIntersection ( const DenseRow & variable_lower_bounds,
const DenseRow & variable_upper_bounds )

Definition at line 1017 of file lp_data.cc.

◆ UseTransposeMatrixAsReference()

void operations_research::glop::LinearProgram::UseTransposeMatrixAsReference ( )

Definition at line 406 of file lp_data.cc.

◆ variable_lower_bounds()

const DenseRow & operations_research::glop::LinearProgram::variable_lower_bounds ( ) const
inline

Definition at line 236 of file lp_data.h.

◆ variable_types()

StrictITIVector< ColIndex, VariableType > operations_research::glop::LinearProgram::variable_types ( ) const
inline

Definition at line 244 of file lp_data.h.

◆ variable_upper_bounds()

const DenseRow & operations_research::glop::LinearProgram::variable_upper_bounds ( ) const
inline

Definition at line 239 of file lp_data.h.

◆ Scale

void Scale ( LinearProgram * lp,
SparseMatrixScaler * scaler,
GlopParameters::ScalingAlgorithm scaling_method )
friend

Definition at line 42 of file lp_data_utils.cc.


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