Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraint creation is not symmetric for combination variable and tensor #371

Open
chopin57otu opened this issue Feb 19, 2024 · 0 comments

Comments

@chopin57otu
Copy link

Describe the bug
MIP allows to create constraint like mip.LinExprTensor <= mip.Var, but not the opposite way.

To Reproduce

>>> import mip
>>> m = mip.Model()
>>> y = m.add_var_tensor((10,2), 'y')
>>> x = m.add_var('x')
>>> m += y >= x
>>> m += x >= y
Traceback (most recent call last):
  File "python\helpers\pydev\pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 1, in <module>
  File "lib\site-packages\mip\entities.py", line 632, in __ge__
    raise TypeError("type {} not supported".format(type(other)))
TypeError: type <class 'mip.ndarray.LinExprTensor'> not supported

Expected behavior
Both constraints mip.LinExprTensor <= mip.Var and mip.Var <= mip.LinExprTensor are supported and behave identically.

Desktop (please complete the following information):

  • Operating System, version: Windows
  • Python version: 3.10.11
  • Python-MIP version (we recommend you to test with the latest version): 1.15.0

Additional context
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant