Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
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
LinearProgramoperator= (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 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 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, 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)
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]

◆ LinearProgram() [2/2]

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()

Definition at line 708 of file lp_data.cc.

◆ ApplyObjectiveScalingAndOffset()

◆ BinaryVariablesList()

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

Definition at line 294 of file lp_data.cc.

◆ BoundsOfIntegerConstraintsAreInteger()

◆ BoundsOfIntegerVariablesAreInteger()

◆ CleanUp()

◆ Clear()

Definition at line 143 of file lp_data.cc.

◆ ClearTransposeMatrix()

◆ ComputeSlackVariableValues()

Definition at line 544 of file lp_data.cc.

◆ constraint_lower_bounds()

Definition at line 222 of file lp_data.h.

◆ constraint_upper_bounds()

Definition at line 225 of file lp_data.h.

◆ CreateNewConstraint()

◆ 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()

◆ 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()

◆ Dump()

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()

Definition at line 474 of file lp_data.cc.

◆ GetConstraintName()

Definition at line 375 of file lp_data.cc.

◆ GetDimensionString()

Definition at line 434 of file lp_data.cc.

◆ GetFirstSlackVariable()

Definition at line 762 of file lp_data.cc.

◆ GetMutableSparseColumn()

◆ GetMutableTransposeSparseMatrix()

◆ GetNonZeroStats()

Definition at line 697 of file lp_data.cc.

◆ GetObjectiveCoefficientForMinimizationVersion()

◆ GetObjectiveStatsString()

Definition at line 461 of file lp_data.cc.

◆ GetPrettyNonZeroStats()

Definition at line 701 of file lp_data.cc.

◆ GetPrettyProblemStats()

Definition at line 675 of file lp_data.cc.

◆ GetProblemStats()

Definition at line 669 of file lp_data.cc.

◆ GetSlackVariable()

Definition at line 766 of file lp_data.cc.

◆ GetSparseColumn()

Definition at line 418 of file lp_data.cc.

◆ GetSparseMatrix()

Definition at line 182 of file lp_data.h.

◆ GetTransposeSparseMatrix()

◆ GetVariableName()

Definition at line 369 of file lp_data.cc.

◆ GetVariableType()

◆ IntegerVariablesList()

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

Definition at line 289 of file lp_data.cc.

◆ IsCleanedUp()

Definition at line 363 of file lp_data.cc.

◆ IsInEquationForm()

◆ IsMaximizationProblem()

Definition at line 178 of file lp_data.h.

◆ IsValid()

Definition at line 1316 of file lp_data.cc.

◆ IsVariableBinary()

Definition at line 309 of file lp_data.cc.

◆ IsVariableInteger()

Definition at line 304 of file lp_data.cc.

◆ mutable_constraint_lower_bounds()

Definition at line 560 of file lp_data.h.

◆ mutable_constraint_upper_bounds()

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()

◆ num_constraints()

Definition at line 215 of file lp_data.h.

◆ num_entries()

Definition at line 218 of file lp_data.h.

◆ num_variables()

Definition at line 212 of file lp_data.h.

◆ objective_coefficients()

Definition at line 230 of file lp_data.h.

◆ objective_offset()

◆ objective_scaling_factor()

◆ 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()

Definition at line 873 of file lp_data.cc.

◆ PopulateFromLinearProgramVariables()

◆ 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()

◆ RemoveObjectiveScalingAndOffset()

◆ Scale()

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

◆ ScaleBounds()

◆ 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()

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()

Definition at line 556 of file lp_data.h.

◆ SetMaximizationProblem()

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()

Definition at line 335 of file lp_data.cc.

◆ SetObjectiveOffset()

Definition at line 340 of file lp_data.cc.

◆ SetObjectiveScalingFactor()

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()

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()

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()

◆ variable_lower_bounds()

Definition at line 236 of file lp_data.h.

◆ variable_types()

Definition at line 244 of file lp_data.h.

◆ variable_upper_bounds()

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: