Skip to content

[Mosek] Deleting constraints breaks attribute access #103

Description

@staadecker

The following code produces an error only when using mosek which is unexpected:

from pyoptinterface.mosek import Model
import pyoptinterface as poi

m = Model()
x, y = m.add_variable(lb=0), m.add_variable(lb=0)
m.set_objective(x + y)
c1, c2 = m.add_linear_constraint(x >= 5), m.add_linear_constraint(y >= 5)
m.delete_constraint(c1)
m.optimize()
print(m.get_constraint_dual(c2))

Error:

MOSEK error 1571 (MSK_RES_ERR_LAST): Invalid index last. A given index was out of expected range, last was 2.
Traceback (most recent call last):
  File "/home/machstg/pyoframe/sketch.py", line 10, in <module>
    print(m.get_constraint_dual(c2))
          ^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error MSK_RES_ERR_LAST : Invalid last.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions