pympcc.MultiStartResult

class pympcc.MultiStartResult(best, runs=<factory>, failures=<factory>)[source]

Bases: object

Aggregate result of a multi-start solve.

Parameters:
best

Result with the lowest objective among successful runs. Falls back to the lowest-objective run overall if every start failed (in which case best.success is False).

Type:

MPCCResult

runs

All per-start results in start order. May be shorter than n_starts if any starts raised an exception (those are recorded in failures instead).

Type:

list of MPCCResult

failures

Tuples (start_index, exception_type_name, message) for every start whose solve() raised. Empty list when all starts completed (success or otherwise).

Type:

list of (int, str, str)

The shortcut attributes ``x``, ``obj``, ``success``, ``comp_residual``
proxy ``best`` so callers that don't care about diversity can use the
object as a drop-in replacement for an :class:`MPCCResult`.
__init__(best, runs=<factory>, failures=<factory>)
Parameters:
Return type:

None

Methods

__init__(best[, runs, failures])

unique_optima(*[, atol_obj, atol_x])

Cluster successful runs by closeness in (obj, x).

Attributes

best: MPCCResult
runs: list[MPCCResult]
failures: list[tuple[int, str, str]]
property x: ndarray
property obj: float
property success: bool
property comp_residual: float
property n_success: int
unique_optima(*, atol_obj=1e-06, atol_x=0.0001)[source]

Cluster successful runs by closeness in (obj, x).

Two runs share a cluster when their objectives differ by less than atol_obj and their iterates agree within atol_x in the infinity norm. The first run encountered in each cluster is returned, in start order.

Return type:

list[MPCCResult]

Parameters: