 |
OR-Tools
8.1
|
Go to the documentation of this file.
24 #ifndef OR_TOOLS_LP_DATA_LP_DATA_H_
25 #define OR_TOOLS_LP_DATA_LP_DATA_H_
32 #include "absl/container/flat_hash_map.h"
33 #include "absl/container/flat_hash_set.h"
47 class SparseMatrixScaler;
75 const std::string&
name()
const {
return name_; }
86 const std::string&
name);
216 return constraint_lower_bounds_;
219 return constraint_upper_bounds_;
224 return objective_coefficients_;
230 return variable_lower_bounds_;
233 return variable_upper_bounds_;
238 return variable_types_;
262 return objective_scaling_factor_;
303 std::string
Dump()
const;
454 bool detect_integer_constraints_for_slack);
541 columns_are_known_to_be_clean_ =
true;
550 void UpdateAllIntegerVariableLists()
const;
554 std::string ProblemStatFormatter(
const absl::string_view format)
const;
558 std::string NonZeroStatFormatter(
const absl::string_view format)
const;
561 void ResizeRowsIfNeeded(RowIndex
row);
566 void PopulateNameObjectiveAndVariablesFromLinearProgram(
592 mutable std::vector<ColIndex> integer_variables_list_;
595 mutable std::vector<ColIndex> binary_variables_list_;
599 mutable std::vector<ColIndex> non_binary_variables_list_;
602 absl::flat_hash_map<std::string, ColIndex> variable_table_;
605 absl::flat_hash_map<std::string, RowIndex> constraint_table_;
618 mutable bool columns_are_known_to_be_clean_;
621 mutable bool transpose_matrix_is_consistent_;
625 mutable bool integer_variables_list_is_consistent_;
632 ColIndex first_slack_variable_;
635 bool dcheck_bounds_ =
true;
638 GlopParameters::ScalingAlgorithm scaling_method);
684 if (std::isnan(lower_bound))
return false;
685 if (std::isnan(upper_bound))
return false;
688 if (lower_bound > upper_bound)
return false;
695 #endif // OR_TOOLS_LP_DATA_LP_DATA_H_
std::string GetPrettyNonZeroStats() const
bool IsVariableBinary(ColIndex col) const
Fractional ApplyObjectiveScalingAndOffset(Fractional value) const
RowIndex num_constraints() const
void PopulateFromDual(const LinearProgram &dual, RowToColMapping *duplicated_rows)
void AddSlackVariablesWhereNecessary(bool detect_integer_constraints)
bool SolutionIsLPFeasible(const DenseRow &solution, Fractional absolute_tolerance) const
void PopulateFromPermutedLinearProgram(const LinearProgram &lp, const RowPermutation &row_permutation, const ColumnPermutation &col_permutation)
std::vector< double > coefficients
void SetDcheckBounds(bool dcheck_bounds)
void SetVariableType(ColIndex col, VariableType type)
const DenseRow & variable_lower_bounds() const
Fractional ScaleObjective(GlopParameters::CostScalingAlgorithm method)
ColIndex GetFirstSlackVariable() const
std::string GetPrettyProblemStats() const
std::string GetProblemStats() const
void SetConstraintBounds(RowIndex row, Fractional lower_bound, Fractional upper_bound)
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)
SparseColumn * GetMutableSparseColumn(ColIndex col)
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
const SparseMatrix & GetTransposeSparseMatrix() const
void NotifyThatColumnsAreClean()
void SetMaximizationProblem(bool maximize)
void AddConstraints(const SparseMatrix &coefficients, const DenseColumn &left_hand_sides, const DenseColumn &right_hand_sides, const StrictITIVector< RowIndex, std::string > &names)
SparseMatrix * GetMutableTransposeSparseMatrix()
void ComputeSlackVariableValues(DenseRow *solution) const
bool AreBoundsValid(Fractional lower_bound, Fractional upper_bound)
ColIndex CreateNewVariable()
RowIndex CreateNewConstraint()
Fractional RemoveObjectiveScalingAndOffset(Fractional value) const
const DenseColumn & constraint_lower_bounds() const
void DeleteRows(const DenseBooleanColumn &rows_to_delete)
void PopulateFromLinearProgram(const LinearProgram &linear_program)
bool SolutionIsMIPFeasible(const DenseRow &solution, Fractional absolute_tolerance) const
ColIndex num_cols() const
void Scale(SparseMatrixScaler *scaler)
const SparseColumn & GetSparseColumn(ColIndex col) const
ProblemSolution(RowIndex num_rows, ColIndex num_cols)
void SetVariableBounds(ColIndex col, Fractional lower_bound, Fractional upper_bound)
void DeleteSlackVariables()
const std::string & name() const
ColIndex FindOrCreateVariable(const std::string &variable_id)
ConstraintStatusColumn constraint_statuses
RowIndex num_rows() const
const std::vector< ColIndex > & BinaryVariablesList() const
bool IsInEquationForm() const
EntryIndex num_entries() const
bool SolutionIsInteger(const DenseRow &solution, Fractional absolute_tolerance) const
std::string GetVariableName(ColIndex col) const
void SetCoefficient(RowIndex row, ColIndex col, Fractional value)
void SetObjectiveScalingFactor(Fractional objective_scaling_factor)
void UseTransposeMatrixAsReference()
bool UpdateVariableBoundsToIntersection(const DenseRow &variable_lower_bounds, const DenseRow &variable_upper_bounds)
bool BoundsOfIntegerVariablesAreInteger(Fractional tolerance) const
std::string GetConstraintName(RowIndex row) const
void ClearTransposeMatrix()
Fractional objective_scaling_factor() const
std::string DebugString() const
#define DCHECK(condition)
Fractional GetObjectiveCoefficientForMinimizationVersion(ColIndex col) const
Fractional objective_offset() const
std::string GetObjectiveStatsString() const
void SetConstraintName(RowIndex row, absl::string_view name)
const std::vector< ColIndex > & NonBinaryVariablesList() const
bool IsVariableInteger(ColIndex col) const
const StrictITIVector< ColIndex, VariableType > variable_types() const
void SetObjectiveOffset(Fractional objective_offset)
std::string GetDimensionString() const
void DeleteColumns(const DenseBooleanRow &columns_to_delete)
void Swap(LinearProgram *linear_program)
void SetName(const std::string &name)
bool IsMaximizationProblem() const
void SetVariableName(ColIndex col, absl::string_view name)
RowIndex FindOrCreateConstraint(const std::string &constraint_id)
void SetObjectiveCoefficient(ColIndex col, Fractional value)
void PopulateFromLinearProgramVariables(const LinearProgram &linear_program)
std::string GetNonZeroStats() const
const DenseRow & objective_coefficients() const
ColIndex num_variables() const
ColIndex GetSlackVariable(RowIndex row) const
VariableStatusRow variable_statuses
const SparseMatrix & GetSparseMatrix() const
EntryIndex num_entries() const
ColIndex CreateNewSlackVariable(bool is_integer_slack_variable, Fractional lower_bound, Fractional upper_bound, const std::string &name)
bool BoundsOfIntegerConstraintsAreInteger(Fractional tolerance) const
const std::vector< ColIndex > & IntegerVariablesList() const
const DenseRow & variable_upper_bounds() const
std::string DumpSolution(const DenseRow &variable_values) const
VariableType GetVariableType(ColIndex col) const
const DenseColumn & constraint_upper_bounds() const
bool SolutionIsWithinVariableBounds(const DenseRow &solution, Fractional absolute_tolerance) const