pympcc.PresolveMap

class pympcc.PresolveMap(keep_vars, fixed_vars, fixed_vals, keep_comp, n_orig, n_comp_orig, n_ineq=0, n_eq=0, keep_ineq=None, keep_eq=None, promote_G=<factory>, promote_H=<factory>, prefix_H_eq=<factory>, prefix_G_eq=<factory>)[source]

Bases: object

Mapping between an original MPCCProblem and its reduced form.

Use expand_result() to lift a result on the reduced problem back to the original variable / comp-pair indexing.

Parameters:
__init__(keep_vars, fixed_vars, fixed_vals, keep_comp, n_orig, n_comp_orig, n_ineq=0, n_eq=0, keep_ineq=None, keep_eq=None, promote_G=<factory>, promote_H=<factory>, prefix_H_eq=<factory>, prefix_G_eq=<factory>)
Parameters:
Return type:

None

Methods

__init__(keep_vars, fixed_vars, fixed_vals, ...)

expand_comp(vec_red, *[, fill])

Scatter a length-len(keep_comp) vector back to n_comp_orig.

expand_result(result, problem_orig)

Expand result (built on the reduced problem) into original space.

expand_x(x_red)

Scatter a reduced-space x back to the original n_orig slots.

Attributes

keep_vars: ndarray
fixed_vars: ndarray
fixed_vals: ndarray
keep_comp: ndarray
n_orig: int
n_comp_orig: int
n_ineq: int = 0
n_eq: int = 0
keep_ineq: ndarray | None = None
keep_eq: ndarray | None = None
promote_G: ndarray
promote_H: ndarray
prefix_H_eq: ndarray
prefix_G_eq: ndarray
property is_identity: bool
expand_x(x_red)[source]

Scatter a reduced-space x back to the original n_orig slots.

Return type:

ndarray

Parameters:

x_red (ndarray)

expand_comp(vec_red, *, fill=0.0)[source]

Scatter a length-len(keep_comp) vector back to n_comp_orig.

Return type:

ndarray

Parameters:
expand_result(result, problem_orig)[source]

Expand result (built on the reduced problem) into original space.

Mutates result in place and also returns it.

Return type:

MPCCResult

Parameters: