Bug about different VarList objects sharing the same components
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- backend-api-design
Research direction
Start with the VarList entry point and run the reproduction from the issue against Python-MIP 1.14.2. Trace how VarList instances add and iterate variables within the same Model; done means separate lists yield only their own variables while existing VarList behavior remains intact.
Written by the indexing model from the issue text.
Description
Describe the bug
For the same model, if I create two VarList (called list1 and list2), then some cache bugs happen.
If I use list1 for storing x_1, x_2, x_3, ... and use list2 for storing y_1, y_2, y_3, ..., then the two lists will sharing elements.
It is very easy to reproduce it.
To Reproduce
import mip # version 1.14.2
model = mip.Model(name="test_model")
var_list = mip.VarList(model=model)
var_list.add(name="x1")
var_list.add(name="x2")
for var in var_list:
print(var.name)
# print outputs:
# x1
# x2
var_list2 = mip.VarList(model=model)
var_list2.add(name="y1")
var_list2.add(name="y2")
var_list2.add(name="y3")
for var in var_list2:
print(var.name)
# print outputs:
# x1
# x2
# y1
Expected behavior
I expect these two var list of the same model should not have the same components.
Desktop (please complete the following information):
- Operating System, version: Linux
- Python version: 3.12
- Python-MIP version (we recommend you to test with the latest version): 1.14.2
Additional context
I have replaced this with the standard Python list in my project to bypass the bug.
Appreciate your work. If it is not a bug, could you tell me your design logic?
- Dominant language
- Linear Programming
- Stars
- 601
- Forks
- 108
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coin-or/python-mip
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
coin-or/python-mip#426 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
coin-or/python-mip#425 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
coin-or/python-mip#423 · 4 comments · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
coin-or/python-mip#422 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
coin-or/python-mip#420 · 4 comments ·
All issues in coin-or/python-mip
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:auth-provider issue-rating: 🌊 off-meta tidepool P2
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100