Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::math_opt::PdlpBridge Class Reference

#include <pdlp_bridge.h>

Public Member Functions

 PdlpBridge ()=default
 
const pdlp::QuadraticProgrampdlp_lp () const
 
InvertedBounds ListInvertedBounds () const
 Returns the ids of variables and linear constraints with inverted bounds.
 
absl::StatusOr< SparseDoubleVectorProto > PrimalVariablesToProto (const Eigen::VectorXd &primal_values, const SparseVectorFilterProto &variable_filter) const
 
absl::StatusOr< SparseDoubleVectorProto > DualVariablesToProto (const Eigen::VectorXd &dual_values, const SparseVectorFilterProto &linear_constraint_filter) const
 
absl::StatusOr< SparseDoubleVectorProto > ReducedCostsToProto (const Eigen::VectorXd &reduced_costs, const SparseVectorFilterProto &variable_filter) const
 
pdlp::PrimalAndDualSolution SolutionHintToWarmStart (const SolutionHintProto &solution_hint) const
 

Static Public Member Functions

static absl::StatusOr< PdlpBridgeFromProto (const ModelProto &model_proto)
 

Detailed Description

Builds a PDLP model (QuadraticProgram) from ModelProto, and provides methods to translate solutions back and forth.

The primary difference in the models are:

  1. PDLP maps the variable/constraint ids to consecutive indices [0, 1, ..., n).
  2. PDLP does not support maximization. If the ModelProto is a maximization problem, the objective is negated (coefficients and offset) before passing to PDLP. On the way back, the objective value, and all dual variables/reduced costs (also for rays) must be negated.

Throughout, it is assumed that the MathOpt protos have been validated, but no assumption is made on the PDLP output. Any Status errors resulting from invalid PDLP output use the status code kInternal.

Definition at line 48 of file pdlp_bridge.h.

Constructor & Destructor Documentation

◆ PdlpBridge()

operations_research::math_opt::PdlpBridge::PdlpBridge ( )
default

Member Function Documentation

◆ DualVariablesToProto()

absl::StatusOr< SparseDoubleVectorProto > operations_research::math_opt::PdlpBridge::DualVariablesToProto ( const Eigen::VectorXd & dual_values,
const SparseVectorFilterProto & linear_constraint_filter ) const

Definition at line 196 of file pdlp_bridge.cc.

◆ FromProto()

absl::StatusOr< PdlpBridge > operations_research::math_opt::PdlpBridge::FromProto ( const ModelProto & model_proto)
static

MathOpt represents quadratic objectives in "terms" form, i.e. as a sum of double * Variable * Variable terms. They are stored in upper triangular form with row_index <= column_index. In contrast, PDLP represents quadratic objectives in "matrix" form as 1/2 x'Qx, where Q is diagonal. To get to the right format, we simply double each diagonal entry.

Note
MathOpt stores the constraint data in row major order, but PDLP wants the data in column major order. There is probably a more efficient method to do this transformation.

Definition at line 81 of file pdlp_bridge.cc.

◆ ListInvertedBounds()

InvertedBounds operations_research::math_opt::PdlpBridge::ListInvertedBounds ( ) const

Returns the ids of variables and linear constraints with inverted bounds.

Definition at line 170 of file pdlp_bridge.cc.

◆ pdlp_lp()

const pdlp::QuadraticProgram & operations_research::math_opt::PdlpBridge::pdlp_lp ( ) const
inline

Definition at line 53 of file pdlp_bridge.h.

◆ PrimalVariablesToProto()

absl::StatusOr< SparseDoubleVectorProto > operations_research::math_opt::PdlpBridge::PrimalVariablesToProto ( const Eigen::VectorXd & primal_values,
const SparseVectorFilterProto & variable_filter ) const
Todo
(b/183616124): we need to support the inverse of these methods for warm start.

Definition at line 190 of file pdlp_bridge.cc.

◆ ReducedCostsToProto()

absl::StatusOr< SparseDoubleVectorProto > operations_research::math_opt::PdlpBridge::ReducedCostsToProto ( const Eigen::VectorXd & reduced_costs,
const SparseVectorFilterProto & variable_filter ) const

Definition at line 203 of file pdlp_bridge.cc.

◆ SolutionHintToWarmStart()

pdlp::PrimalAndDualSolution operations_research::math_opt::PdlpBridge::SolutionHintToWarmStart ( const SolutionHintProto & solution_hint) const

We are implicitly assuming that all missing IDs have correspoding value 0.

Definition at line 210 of file pdlp_bridge.cc.


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