Skip to main content

Module qp_extract

Module qp_extract 

Source
Expand description

Extract a pounce_convex::QpProblem (standard form) from a parsed .nl problem, for the LP/QP dispatch path (Phase 2).

The classifier (crate::dispatch) has already decided the problem is an LP or convex QP; this module marshals the parsed NlProblem into the standard form the convex IPM consumes:

minimize    ½ xᵀP x + cᵀx
subject to  A x = b          (equalities)
            G x ≤ h          (inequalities, incl. finite var bounds)

Mapping from the .nl representation:

  • Objective. P is the Hessian of the (degree-≤2) objective — recovered with the same analyze_quadratic the classifier uses, so P here is exactly the matrix whose definiteness was tested. c is the objective’s linear part. A maximize objective is negated into a minimization.
  • Constraints. Each row has a linear part and bounds g_l ≤ row ≤ g_u. An equality (g_l == g_u) becomes a row of A; a one- or two-sided inequality becomes one or two rows of G (row ≤ g_u and/or −row ≤ −g_l).
  • Variable bounds. Finite x_l/x_u become G rows (−x_i ≤ −x_l, x_i ≤ x_u); the .nl “infinity” sentinel (|v| ≥ 1e19) is treated as no bound.

Enums§

ConRowMap
Where each .nl constraint’s rows landed in the standard-form QP, so the QP’s multipliers can be mapped back to a per-.nl-constraint dual for the .sol. One entry per original constraint, in order.
ConSocpMap
Where each .nl constraint landed in the standard-form conic program, so the cone multipliers can be mapped back to a per-.nl-constraint dual. One entry per original constraint, in order. (Analogue of ConRowMap for the SOCP path produced by extract_socp_with_map.)

Functions§

extract_qp
Convert a classified LP/convex-QP NlProblem into QpProblem standard form. Returns None if the objective is not actually a degree-≤2 polynomial (should not happen for a problem the classifier routed here, but the conversion is total and falls back gracefully).
extract_qp_with_map
Extract the QP, the constraint→row provenance map, and the objective constant folded into the nonlinear tree (see below), together.
extract_socp_with_map
Convert a classified convex QCQP NlProblem into the conic standard form the SOCP IPM consumes:
recover_duals
Map the QP solver’s multipliers (y, z) back to a per-.nl- constraint dual vector (length prob.m), in the AMPL .sol convention used by POUNCE’s NLP path.
recover_socp_duals
Map the SOCP solver’s multipliers (y, z) back to a per-.nl-constraint dual vector (length prob.m), in POUNCE’s NLP-path .sol convention.