Expand description
POUNCE C ABI — port of Interfaces/IpStdCInterface.{h,cpp}.
Provides the CreateIpoptProblem / IpoptSolve / FreeIpoptProblem C
entry points that existing PyIpopt / cyipopt / JuMP wrappers link
against. Function names and signatures match upstream Ipopt 3.14.x
exactly so consumers can swap libipopt.{dylib,so} for
libpounce_cinterface without rebuilding.
Surface area (in IpStdCInterface.h order):
- Lifecycle:
CreateIpoptProblem,FreeIpoptProblem. - Options:
AddIpoptStrOption,AddIpoptNumOption,AddIpoptIntOption,OpenIpoptOutputFile,SetIpoptProblemScaling. - Callbacks:
SetIntermediateCallback. - Solve:
IpoptSolve. - Introspection (only valid inside an intermediate callback):
GetIpoptCurrentIterate,GetIpoptCurrentViolations. - Library info:
GetIpoptVersion.
Pounce extensions for post-solve stats (not present in upstream
Ipopt’s C API): GetIpoptIterCount, GetIpoptSolveTime,
GetIpoptPrimalInf, GetIpoptDualInf, GetIpoptComplInf.
All entry points are extern "C" and #[no_mangle]. Pointers are
raw and the caller is responsible for lifetime; the IpoptProblem
handle is opaque (*mut c_void from C’s perspective). The Fortran
77 ABI shim lives in fortran.
Re-exports§
Modules§
- bounds
- In-place bound updates on an
IpoptProblemhandle (gh#1147, Stage 2), and the indexed pair records they need. - errors
- One error namespace for the whole C API.
- fortran
- Fortran 77 ABI shim — port of
Interfaces/IpStdFInterface.c. - qp
- Matrix-form convex QP / conic entry (gh#1147 Stage 3): the
PounceQp*handle, its builders,PounceQpSolve, the getters and the report writer. - solver
- Session-style C ABI built on
pounce_sensitivity::Solver.
Structs§
- Ipopt
Problem Info - Internal owned state behind the opaque
IpoptProblemhandle.#[repr(C)]is unnecessary because C only sees the pointer. - Pounce
Complementarity Solve - C mirror of one
MpccSolveRecord, forpounce.h’sPounceComplementaritySolve. Extensible, likePounceComplementarityStats. - Pounce
Complementarity Stats - C mirror of the driver’s
MpccOutcomeforpounce.h’sPounceComplementarityStats. Field order is the ABI (Pounce.jl mirrors structs field for field);tests/c_examples_build_and_run.rsholds every offset to the C compiler’s. Sentinels instead of discriminants:NaNfor a real that was not measured (or is not finite, as the report’snull),-1for a count or flag whose record is absent. - Pounce
Linear Solver Stats - C mirror of
pounce_linsol::summary::LinearSolverSummary, laid out forpounce.h’sPounceLinearSolverStats. Optional fields carry sentinels rather than a discriminant, because a plain struct of scalars is what a C or C++ caller can consume without an accessor per field:NaNfor absent reals,-1for absent counts.
Constants§
- POUNCE_
CC_ B_ VERDICT_ ABSENT b_verdict: the check did not run.- POUNCE_
CC_ B_ VERDICT_ B b_verdict: B-stationary.- POUNCE_
CC_ B_ VERDICT_ NOT_ B b_verdict: a branch descends.- POUNCE_
CC_ B_ VERDICT_ NOT_ CHECKED b_verdict: not decided (the reason isPOUNCE_CC_TEXT_B_REASON).- POUNCE_
CC_ CLASS_ ABSENT certificate_class: no certificate (the model could not be evaluated at the reported point).- POUNCE_
CC_ CLASS_ NONE certificate_class: not a stationary point of the model.- POUNCE_
CC_ CLASS_ NOT_ SEARCHED certificate_class: not determined (the multiplier set is too large to search).- POUNCE_
CC_ CLASS_ S certificate_class: strongly stationary.- POUNCE_
CC_ CLASS_ W certificate_class: weakly stationary only.- POUNCE_
CC_ REPORTED_ ANSWER reported: a formulation answered.- POUNCE_
CC_ REPORTED_ FEASIBLE_ UNCERTIFIED reported: a converged point with every product in tolerance, no stationarity certified.- POUNCE_
CC_ REPORTED_ VERDICT reported: no feasible point; the exact-product solve’s verdict.- POUNCE_
CC_ REPORTED_ WEAK_ FALLBACK reported: a weakly stationary point, reported when none answered.- POUNCE_
CC_ TEXT_ B_ REASON GetPounceComplementarityText: why the B-stationarity check was not decided.- POUNCE_
CC_ TEXT_ POLISH_ REASON GetPounceComplementarityText: why the polish’s point was not taken.- POUNCE_
CC_ TEXT_ SUMMARY GetPounceComplementarityText: the driver’s one-line account.- POUNCE_
COMPLEMENTS_ PAIR_ LOWER x >= lonly: the row’s lower bound was set to0(F >= 0) and a native one-sided pair declared.- POUNCE_
COMPLEMENTS_ PAIR_ MIXED xboxed,l < uboth finite: a native mixed pair was declared; the row’s bounds are unchanged (free).- POUNCE_
COMPLEMENTS_ PAIR_ UPPER x <= uonly: the row’s upper bound was set to0(F <= 0) and a native one-sided pair declared.- POUNCE_
COMPLEMENTS_ ROW_ FIXED_ NO_ PAIR xfree: both row bounds were set to0(F = 0); no pair.- POUNCE_
COMPLEMENTS_ VAR_ FIXED_ NO_ PAIR xfixed (l == u): nothing changed,Fstays free; no pair.
Functions§
- AddIpopt
IntOption ⚠ - Port of
AddIpoptIntOption. - AddIpopt
NumOption ⚠ - Port of
AddIpoptNumOption. - AddIpopt
StrOption ⚠ - Port of
IpStdCInterface.cpp:AddIpoptStrOption. - AddPounce
Complementarity ⚠Pair - Declare one complementarity pair: constraint row
rowwith variablevar, both in the problem’s index style (gh#1147). The pair is in POUNCE’s native shapes — one-sided, one-sided plus a plain bound, or mixed — exactly as Python’sProblem(complementarity=)and the.nlreader accept, and is checked at once by the same classifier the solve’s lowering runs (pounce_nlp::mpcc::validate_pairs), against the handle’s bounds — those given toCreateIpoptProblem, asAddPounceComplementsConstraintmay have edited them — and the pairs already declared. - AddPounce
Complements ⚠Constraint - Declare MOI’s
[F, x] ∈ Complementsfor constraint rowrow(F) and variablevar(x), both in the problem’s index style (gh#1147). - Clear
Pounce ⚠Complementarity Pairs - Drop every declared complementarity pair. Returns
FALSEonly on a NULL handle. - Create
Ipopt ⚠Problem - Port of
IpStdCInterface.cpp:CreateIpoptProblem. Returns NULL on invalid arguments (negative n/m, missing required callbacks, NULL bound pointers when the corresponding dimension is positive). - Free
Ipopt ⚠Problem - Port of
IpStdCInterface.cpp:FreeIpoptProblem. - GetIpopt
Compl ⚠Inf - Final complementarity error for the most recent solve.
- GetIpopt
Current ⚠Iterate - Port of
IpStdCInterface.cpp:GetIpoptCurrentIterate(Ipopt 3.14+). Designed to be called from inside an intermediate callback to inspectx, the bound multipliersz_L/z_U, the constraint valuesg, and the constraint multiplierslambdaat the current iterate. - GetIpopt
Current ⚠Violations - Port of
IpStdCInterface.cpp:GetIpoptCurrentViolations(Ipopt 3.14+). Same contract asGetIpoptCurrentIterate; returnsFALSEwhen called outside an active intermediate callback. - GetIpopt
Dual ⚠Inf - Final dual infeasibility (max gradient-of-Lagrangian norm) for the most recent solve.
- GetIpopt
Iter ⚠Count - Number of IPM iterations in the most recent solve, or
0if the problem has not been solved yet. - GetIpopt
Primal ⚠Inf - Final primal infeasibility (max constraint violation) for the most recent solve.
- GetIpopt
Solve ⚠Time - Wall-clock solve time in seconds for the most recent solve, or
0.0if the problem has not been solved yet. - GetIpopt
Version ⚠ - Port of
IpStdCInterface.cpp:GetIpoptVersion(Ipopt 3.14.18+). Writes the pounce crate’smajor.minor.patchinto the buffers. Any pointer may be NULL to skip that component. - GetPounce
Complementarity ⚠Pair Count - Number of declared complementarity pairs, or
-1on a NULL handle. - GetPounce
Complementarity ⚠Pairs - Copy the declared pairs, in declaration order and in the problem’s
index style, into
rowsandvars(each sized byGetPounceComplementarityPairCount). ReturnsFALSE, writing nothing, on a NULL handle or a NULL array while pairs are declared; with no pairs it returnsTRUEand the arrays may be NULL. - GetPounce
Complementarity ⚠Solve - Lowered solve
k(0-based, in the order the driver ran them,k < n_solves) of the most recent driver solve; the caller setssolve->struct_size = sizeof(PounceComplementaritySolve)first. ReturnsFALSE, leavingsolveuntouched, on a NULL argument, a shortstruct_size, akout of range, and wheneverGetPounceComplementarityStatswould. - GetPounce
Complementarity ⚠Stats - What the complementarity driver did on the most recent
IpoptSolve(gh#1147): the strategy, what was reported and by which formulation, the iteration totals, the stationarity certificate, the B-stationarity check and the polish — the solve report’scomplementarityblock as a struct of scalars. The caller setsstats->struct_size = sizeof(PounceComplementarityStats)first. ReturnsFALSE, leavingstatsuntouched, on a NULL argument, astruct_sizesmaller than this release’s size, before any solve, and when the most recent solve did not run the driver (no pairs were declared, or it was refused or failed before the driver returned). The record describes the most recent solve: clearing the pairs afterwards does not erase it, the next solve does. - GetPounce
Complementarity ⚠Text - One of the driver’s free-form texts for the most recent driver solve,
with C’s
snprintfcontract: writes at mostbuflen - 1bytes of it plus a NUL intobufand returns its full length in bytes, without the NUL — sobuf = NULL, buflen = 0sizes the buffer, and a return>= buflenmeans it was truncated. Returns-1, writing nothing, when there is no such text: a NULL handle, awhichthat names none, wheneverGetPounceComplementarityStatswould returnFALSE, or a text this run does not have (POUNCE_CC_TEXT_POLISH_REASONunless the polish ran and was not taken;POUNCE_CC_TEXT_B_REASONunless the B-stationarity check ran and was not decided). A NULLbufor abuflen <= 0writes nothing and still returns the length. - GetPounce
FdHessian ⚠Stats - Finite-difference Hessian census from the most recent solve. Any pointer may be NULL to skip that component.
- GetPounce
Linear ⚠Solver Stats - Post-mortem of the KKT linear solver for the most recent solve.
- GetPounce
Option ⚠Type - Which
AddIpopt*Optionsetter a keyword expects. - GetPounce
Restoration ⚠Stats - Restoration-phase activity in the most recent solve. Each output may be NULL to skip it; all yield zero before the first solve.
- Ipopt
Clear ⚠Nonlinear Variables - Drop a subset declared by
IpoptSetNonlinearVariables, restoring the default (every variable treated as nonlinear). - Ipopt
Clear ⚠Warm Start Working Set - Drop any pending warm-start working set without solving. The
next
IpoptSolvewill cold-start. - Ipopt
Enable ⚠Iter History - Enable per-iteration history capture on the underlying
IpoptApplication. Must be called beforeIpoptSolvefor the trajectory to appear in the report written byIpoptWriteSolveReport. Off by default — capturing each iterate has a small per-iter cost the IPM core skips otherwise. - Ipopt
GetWorking ⚠Set - Retrieve the working set produced by the most recent SQP solve
(
algorithm = active-set-sqp). Buffer sizes arenforbound_status_outandmforcons_status_out. PassNULLfor either to skip that side. Entryiis variablei/ constraint rowiin the problem’s own order (a variable fixed byx_L == x_UreadsPOUNCE_WS_FIXED_OR_EQ), the same indexingIpoptSetWarmStartWorkingSettakes. - Ipopt
SetNonlinear ⚠Variables - Declare which variables enter the problem nonlinearly (gh#624).
- Ipopt
SetWarm ⚠Start Working Set - Supply a warm-start working set consumed by the next
IpoptSolveon this problem. PassNULLfor either side to cold-start it. The caller-owned buffers are copied; reuse across calls is safe. Indexed likeIpoptGetWorkingSet: entryiis variablei/ constraint rowiin the problem’s own order. - Ipopt
Solve ⚠ - Port of
IpStdCInterface.cpp:IpoptSolve. Returns theApplicationReturnStatusinteger. - Ipopt
Solve ⚠Warm Start - Convenience one-shot: equivalent to
IpoptSetWarmStartWorkingSet+IpoptSolve+IpoptGetWorkingSetin sequence. The input/output working-set buffers are independent (so a caller can read back the new working set into the same array used as input). PassNULLfor any in/out buffer to skip that side. - Ipopt
Write ⚠Solve Report - Write a
pounce.solve-report/v1JSON file capturing the most recentIpoptSolveresult.pathis a NUL-terminated UTF-8 filesystem path.detailis one of"summary"or"full"(NUL-terminated); passNULLfor the default ("summary"). - Open
Ipopt ⚠Output File - Port of
IpStdCInterface.cpp:OpenIpoptOutputFile. Opensfile_nameatprint_leveland attaches a journalistFileJournalso all solver output is mirrored to disk. Equivalent to settingoutput_file+file_print_leveloptions and triggeringIpoptApplication::Initialize. - SetIntermediate
Callback ⚠ - Port of
SetIntermediateCallback. - SetIpopt
Problem ⚠Scaling - Port of
IpStdCInterface.cpp:SetIpoptProblemScaling. Stores user-provided NLP scaling on the problem; the scaling is forwarded to the solver viaTNLP::get_scaling_parameterswhen the optionnlp_scaling_method=user-scalingis set. Passing NULL forx_scaling/g_scalingdisables scaling on that axis. - SetPounce
Complementarity ⚠Pairs - Replace the declared pairs with
n_pairspairs(rows[k], vars[k]), indices in the problem’s index style. All or nothing: the new set is validated as a whole (on its own, not against the pairs it replaces) and stored only if every pair passes; otherwise the previous set stays.n_pairs == 0clears the set (the arrays may then be NULL).
Type Aliases§
- Bool
- Mirrors C
Bool, whichpounce.h— like Ipopt 3.14’sIpStdCInterface.h— declares as the C99bool. That is one byte, so this isu8and notc_int. - Eval_
F_ CB - Eval_
G_ CB - Eval_
Grad_ F_ CB - Eval_
H_ CB - Eval_
Jac_ G_ CB - Index
- Mirrors C
Index. - Intermediate_
CB - Ipopt
Bound Status - C-ABI encoding of
pounce_qp::BoundStatus(§7.2 of the active-set-SQP design note). Stable values:0 = Inactive,1 = AtLower,2 = AtUpper,3 = Fixed. - Ipopt
Cons Status - C-ABI encoding of
pounce_qp::ConsStatus(§7.2). Stable values:0 = Inactive,1 = AtLower,2 = AtUpper,3 = Equality. - Ipopt
Problem - Number
- Mirrors C
Numbertypedef inIpStdCInterface.h.