Skip to content

[bug] pyprima does not adjust linear/nonlinear constraints when removing fixed bounds #249

@nbelakovski

Description

@nbelakovski

The following simple test program raises and error due to a size mismatch with the linear constraints:

from pyprima import minimize, LinearConstraint as LC
import numpy as np

def f(x):
        return np.sum(x**2)

lb = [-1, None, None]
ub = [-1, None, None]
bounds = [(a, b) for a, b in zip(lb, ub)]
lc = LC(np.array([1, 1, 1]), lb=9, ub=15)
res = minimize(f, x0=np.array([1, 1, 1]), constraints=lc, bounds=bounds)

The error arises because while we have code to eliminate variables with fixed bounds, we are not updating the linear constraint matrix (or the nonlinear constraint function) to take into account the new size of x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions