pympcc.MPCCResult

class pympcc.MPCCResult(x, obj, status, message, G, H, comp_residual, comp_residual_mean, success, strategy, history=<factory>, solve_time=None, mult_g=None, stationarity='unknown', kkt_residual=None, cleanup_status=None, cleanup_n_iter=None, cleanup_obj=None, cleanup_active_set=None, cleanup_accepted=None, comp_G_scale=None, comp_H_scale=None, cq=None, cq_active_set_sizes=None, cq_rank_deficit=None, b_stationary=None, b_stationary_witness=None, b_stationary_min_descent=None, per_pair_status=None, mult_comp_G_mpcc=None, mult_comp_H_mpcc=None, tnlp_refined=None, sosc=None, sosc_min_eigenvalue=None, sosc_skipped_reason=None, jac_condition=None, hessian_condition_estimate=None, time_limit_hit=False, merit_cross_check=None, jac_row_norms=None, jac_col_norms=None, degeneracy_report=None, initial_point_stats=None, n_ipopt_iter_total=None, warmstart_savings_iter=None)[source]

Bases: object

Result returned by pympcc.solve() or pympcc.MPCCSolver.solve().

Parameters:
  • x (ndarray)

  • obj (float)

  • status (int)

  • message (str)

  • G (ndarray)

  • H (ndarray)

  • comp_residual (float)

  • comp_residual_mean (float)

  • success (bool)

  • strategy (str)

  • history (list[IterationInfo])

  • solve_time (float | None)

  • mult_g (ndarray | None)

  • stationarity (str)

  • kkt_residual (float | None)

  • cleanup_status (int | None)

  • cleanup_n_iter (int | None)

  • cleanup_obj (float | None)

  • cleanup_active_set (tuple | None)

  • cleanup_accepted (bool | None)

  • comp_G_scale (ndarray | None)

  • comp_H_scale (ndarray | None)

  • cq (str | None)

  • cq_active_set_sizes (dict | None)

  • cq_rank_deficit (int | None)

  • b_stationary (str | None)

  • b_stationary_witness (tuple | None)

  • b_stationary_min_descent (float | None)

  • per_pair_status (list | None)

  • mult_comp_G_mpcc (ndarray | None)

  • mult_comp_H_mpcc (ndarray | None)

  • tnlp_refined (Any | None)

  • sosc (bool | None)

  • sosc_min_eigenvalue (float | None)

  • sosc_skipped_reason (str | None)

  • jac_condition (float | None)

  • hessian_condition_estimate (float | None)

  • time_limit_hit (bool)

  • merit_cross_check (dict | None)

  • jac_row_norms (dict | None)

  • jac_col_norms (dict | None)

  • degeneracy_report (dict | None)

  • initial_point_stats (dict | None)

  • n_ipopt_iter_total (int | None)

  • warmstart_savings_iter (int | None)

x

Solution vector.

Type:

ndarray

obj

Objective value at the solution.

Type:

float

status

IPOPT exit code of the final NLP solve. Common values: 0 = Solve_Succeeded, 1 = Solved_To_Acceptable_Level, -1 = Maximum_Iterations_Exceeded, 2 = Infeasible_Problem_Detected.

Type:

int

message

Human-readable status from IPOPT.

Type:

str

G

G(x*) values at the solution.

Type:

ndarray, shape (n_comp,)

H

H(x*) values at the solution.

Type:

ndarray, shape (n_comp,)

comp_residual

Complementarity feasibility measure: max_i |G_i(x*) * H_i(x*)|.

Type:

float

comp_residual_mean

Mean complementarity residual: mean_i |G_i(x*) * H_i(x*)|.

Type:

float

success

True when IPOPT status is 0 (Solve_Succeeded) or 1 (Solved_To_Acceptable_Level).

Type:

bool

strategy

Name of the reformulation strategy used.

Type:

str

solve_time

Sum of wall-clock seconds spent inside each nlp.solve() call. Excludes strategy setup (NLP construction, sparsity computation), callback invocations, and post-solve stationarity classification. None when not measured (e.g. results constructed programmatically).

Type:

float or None

history

Per-iteration diagnostics for iterative strategies (Scholtes, smoothing). Empty for the direct strategy.

Type:

list[IterationInfo]

__init__(x, obj, status, message, G, H, comp_residual, comp_residual_mean, success, strategy, history=<factory>, solve_time=None, mult_g=None, stationarity='unknown', kkt_residual=None, cleanup_status=None, cleanup_n_iter=None, cleanup_obj=None, cleanup_active_set=None, cleanup_accepted=None, comp_G_scale=None, comp_H_scale=None, cq=None, cq_active_set_sizes=None, cq_rank_deficit=None, b_stationary=None, b_stationary_witness=None, b_stationary_min_descent=None, per_pair_status=None, mult_comp_G_mpcc=None, mult_comp_H_mpcc=None, tnlp_refined=None, sosc=None, sosc_min_eigenvalue=None, sosc_skipped_reason=None, jac_condition=None, hessian_condition_estimate=None, time_limit_hit=False, merit_cross_check=None, jac_row_norms=None, jac_col_norms=None, degeneracy_report=None, initial_point_stats=None, n_ipopt_iter_total=None, warmstart_savings_iter=None)
Parameters:
  • x (ndarray)

  • obj (float)

  • status (int)

  • message (str)

  • G (ndarray)

  • H (ndarray)

  • comp_residual (float)

  • comp_residual_mean (float)

  • success (bool)

  • strategy (str)

  • history (list[IterationInfo])

  • solve_time (float | None)

  • mult_g (ndarray | None)

  • stationarity (str)

  • kkt_residual (float | None)

  • cleanup_status (int | None)

  • cleanup_n_iter (int | None)

  • cleanup_obj (float | None)

  • cleanup_active_set (tuple | None)

  • cleanup_accepted (bool | None)

  • comp_G_scale (ndarray | None)

  • comp_H_scale (ndarray | None)

  • cq (str | None)

  • cq_active_set_sizes (dict | None)

  • cq_rank_deficit (int | None)

  • b_stationary (str | None)

  • b_stationary_witness (tuple | None)

  • b_stationary_min_descent (float | None)

  • per_pair_status (list | None)

  • mult_comp_G_mpcc (ndarray | None)

  • mult_comp_H_mpcc (ndarray | None)

  • tnlp_refined (Any | None)

  • sosc (bool | None)

  • sosc_min_eigenvalue (float | None)

  • sosc_skipped_reason (str | None)

  • jac_condition (float | None)

  • hessian_condition_estimate (float | None)

  • time_limit_hit (bool)

  • merit_cross_check (dict | None)

  • jac_row_norms (dict | None)

  • jac_col_norms (dict | None)

  • degeneracy_report (dict | None)

  • initial_point_stats (dict | None)

  • n_ipopt_iter_total (int | None)

  • warmstart_savings_iter (int | None)

Return type:

None

Methods

__init__(x, obj, status, message, G, H, ...)

summary([verbosity])

Return a formatted summary of the result.

to_dataframe()

Return a per-complementarity-pair pandas.DataFrame.

to_json()

Serialize the result to a JSON string.

unscale_comp_multipliers(mpcc_mult_G, ...)

Convert scaled-space comp multipliers back to original space.

Attributes

x: ndarray
obj: float
status: int
message: str
G: ndarray
H: ndarray
comp_residual: float
comp_residual_mean: float
success: bool
strategy: str
history: list[IterationInfo]
solve_time: float | None = None
mult_g: ndarray | None = None
stationarity: str = 'unknown'
kkt_residual: float | None = None
cleanup_status: int | None = None
cleanup_n_iter: int | None = None
cleanup_obj: float | None = None
cleanup_active_set: tuple | None = None
cleanup_accepted: bool | None = None
comp_G_scale: ndarray | None = None
comp_H_scale: ndarray | None = None
cq: str | None = None
cq_active_set_sizes: dict | None = None
cq_rank_deficit: int | None = None
b_stationary: str | None = None
b_stationary_witness: tuple | None = None
b_stationary_min_descent: float | None = None
per_pair_status: list | None = None
mult_comp_G_mpcc: ndarray | None = None
mult_comp_H_mpcc: ndarray | None = None
tnlp_refined: Any | None = None
sosc: bool | None = None
sosc_min_eigenvalue: float | None = None
sosc_skipped_reason: str | None = None
jac_condition: float | None = None
hessian_condition_estimate: float | None = None
time_limit_hit: bool = False
merit_cross_check: dict | None = None
jac_row_norms: dict | None = None
jac_col_norms: dict | None = None
degeneracy_report: dict | None = None
initial_point_stats: dict | None = None
n_ipopt_iter_total: int | None = None
warmstart_savings_iter: int | None = None
unscale_comp_multipliers(mpcc_mult_G, mpcc_mult_H)[source]

Convert scaled-space comp multipliers back to original space.

If the problem was solved with comp_G_scale/comp_H_scale active, IPOPT’s multipliers correspond to the scaled constraint s · G(x) 0. Original-space duals satisfy μ = s · μ̃ (chain rule). Returns the input unchanged if no scaling was used.

Return type:

tuple[ndarray, ndarray]

Parameters:
to_json()[source]

Serialize the result to a JSON string.

Arrays are converted to lists. Fields that are None are included as JSON null. The history list is omitted (use summary(verbosity=2) for human-readable history).

Returns:

JSON-encoded result suitable for logging, benchmarking, or storage.

Return type:

str

to_dataframe()[source]

Return a per-complementarity-pair pandas.DataFrame.

Columns: pair, G, H, GH, status, and (when available from TNLP refinement) mu_G, mu_H.

Requires pandas.

Returns:

One row per complementarity pair.

Return type:

pandas.DataFrame

Raises:

ImportError – When pandas is not installed.

summary(verbosity=1)[source]

Return a formatted summary of the result.

Parameters:

verbosity (int) – 0 — single-line headline. 1 — multi-section block (default); shows objective, residuals, stationarity, populated diagnostics, and performance. 2 — also includes the per-iteration history table.

Return type:

str