Comments (6)
Hi, I need more details to debug it. First, the optimization model. Second, more information on you environment. Operating system, python version, Python-MIP version.
from python-mip.
Sorry for the missing information. Below I copied the model that is an IP (I had the same problem with a MIP).
Environment:
Operating system: Windows 10
Python version: Python 3.7.1
Python-MIP version: 1.6.4
`
#Create Integer Programming Model
m = Model(solver_name=CBC)
#DECISION VARIABLES
x = {}
y = {}
#Define x variable, task i placed to work station k
for i in range(1, numTasks+1):
for k in range(numStations):
if ws_task_match[i-1][k] == 1:
x[(i, k)] = m.add_var(var_type=BINARY, name="x%d,%d" % (i, k))
#Define y variable, work station k is used or not
for k in range(numStations):
y[(k)] = m.add_var(var_type=BINARY, name="y%d" % (k))
#PARAMETERS
#CONSTRAINTS
#T1.1: Ensures the workload assigned to each work station cannot exceed the cycle time
for k in range(numStations):
if k not in fixedStations:
if k in dec_stations:
m += (xsum(times.time[i-1]*x[(i,k)] for i in range(1, numTasks+1) if ws_task_match[i-1][k] == 1) <= dec_cycleTime * y[(k)])
else:
m += (xsum(times.time[i-1]*x[(i,k)] for i in range(1, numTasks+1) if ws_task_match[i-1][k] == 1) <= cycleTime * y[(k)])
else:
if k in dec_stations:
if fixed_ws_time[k] < dec_cycleTime:
m += (xsum(times.time[i-1]*x[(i,k)] for i in range(1, numTasks+1) if ws_task_match[i-1][k] == 1) <= dec_cycleTime * y[(k)])
else:
m += y[k] == 1
else:
if fixed_ws_time[k] < cycleTime:
m += (xsum(times.time[i-1]*x[(i,k)] for i in range(1, numTasks+1) if ws_task_match[i-1][k] == 1) <= cycleTime * y[(k)])
else:
m += y[k] == 1
#C1: Ensures tasks to be assigned to exactly one work station
for i in range(1, numTasks+1):
if i not in irrTasks:
m += (xsum(x[(i,k)] for k in range(numStations) if ws_task_match[i-1][k] == 1) == 1)
#C2: Precedence Constraints
for i in range(1, numTasks+1):
for j in range(1, numTasks+1):
if p[i][j] == 1:
if not interval[i][1] <= interval[j][0] or interval[j][1] <= interval[i][0]:
for v in range(1, numStations):
m += (xsum(x[(i,k)] for k in range(v,numStations) if ws_task_match[i-1][k] == 1) <=
1 - xsum(x[(j,k)] for k in range(v) if ws_task_match[j-1][k] == 1))
#C3: Adjacency Constraints
for i in range(1, numTasks+1):
for j in range(1, numTasks+1):
if i < j and adjacency[i][j] == 1:
for k in range(numStations):
if ws_task_match[i-1][k] == 1 and ws_task_match[j-1][k]:
m += (x[(i,k)] == x[(j,k)])
#OBJECTIVE FUNCTION
m.objective = xsum(y[(k)] for k in range(numStations))
#Solve the model
m.optimize(max_seconds=300)`
from python-mip.
Small remarks:
- the code above posted is not reproducible as it's incomplete (e.g.
numTasks
)- the only thing to get from here is that there are nested loops of size 3 which might indicate a big model
Wild guess: you run into memory-problems (maybe adding more and more cutting-planes; opening up more and more nodes leads to increased consumption).
Besides the creation of some reproducible example, i would recommend:
- observe your memory during the run
- play with your problematic parameters on a down-scaled problem
- meaning: e.g. 50% of the tasks
from python-mip.
Yes, it is a big model but Gurobi and Cbc are able to solve it. I only have this crash when I am trying to solve it with Cbc with a time limit which forces the program to stop at a near-optimal solution.
In the zip file, I share all the necessary files to be able to reproduce the problem on Jupyter. You should run the ''Main_function''.
Please try to run the program in two different scenarios to see the problem. Scenario 1: parameter ''max_seconds=120'' and Scenario 2: ''max_seconds=30'' at the top of the main function. While there is no issue with the second scenario I have the error in the first scenario.
I also attached the error message and the Jupyter command screen.
Thank you for your help
from python-mip.
Hi @iyilmazlar , just tested the notebook in Python-MIP 1.6.8 (on linux) and it worked fined. Not sure if it worked because it was on linux or because this is a new Python-MIP version. Could you please check if the problem persists in 1.6.8 ?
Thanks, follows the last lines of the output in my computer:
Cbc0010I After 2536 nodes, 113 on tree, 57 best solution, best possible 53.968978 (109.15 seconds)
Cbc0010I After 2569 nodes, 106 on tree, 57 best solution, best possible 53.968978 (110.16 seconds)
Cbc0010I After 2622 nodes, 104 on tree, 57 best solution, best possible 53.968978 (111.19 seconds)
Cbc0010I After 2672 nodes, 104 on tree, 57 best solution, best possible 53.968978 (112.26 seconds)
Cbc0020I Exiting on maximum time
Cbc0005I Partial search - best objective 57 (best possible 53.968978), took 124764 iterations and 2706 nodes (112.98 seconds)
Cbc0032I Strong branching done 4762 times (125167 iterations), fathomed 27 nodes and fixed 210 variables
Cbc0035I Maximum depth 59, 60092 variables fixed on reduced cost
Cuts at root node changed objective from 53.2645 to 53.969
Probing was tried 568 times and created 9203 cuts of which 0 were active after adding rounds of cuts (4.822 seconds)
Gomory was tried 562 times and created 1408 cuts of which 0 were active after adding rounds of cuts (3.974 seconds)
Knapsack was tried 563 times and created 3043 cuts of which 0 were active after adding rounds of cuts (6.770 seconds)
Clique was tried 27 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.060 seconds)
MixedIntegerRounding2 was tried 563 times and created 2725 cuts of which 0 were active after adding rounds of cuts (3.898 seconds)
FlowCover was tried 27 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.025 seconds)
TwoMirCuts was tried 562 times and created 4583 cuts of which 0 were active after adding rounds of cuts (2.580 seconds)
ZeroHalf was tried 1 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.008 seconds)
ImplicationCuts was tried 24 times and created 337 cuts of which 0 were active after adding rounds of cuts (0.031 seconds)
Result - Stopped on time limit
Objective value: 57.00000000
Lower bound: 53.969
Gap: 0.06
Enumerated nodes: 2706
Total iterations: 124764
Time (CPU seconds): 112.96
Time (Wallclock seconds): 113.41
Total time (CPU seconds): 112.96 (Wallclock seconds): 113.41
from python-mip.
Having the same issue too. With mip version 1.11.0. Seems to be with Windows only. If running on Mac or Linux, the program is fine.
from python-mip.
Related Issues (20)
- Confusing Behaviour with disposing of Gurobi Environment HOT 1
- Incorrect file extension when call write() with CBC solver HOT 1
- Explicitly provide supported versions of Cbc HOT 2
- Passing Solver explicitly causes UnboundLocalError
- [1.15.0] Tests fail: ImportError: cannot import name '__version__' from 'mip._version' (/usr/ports/math/py-mip/work-py39/mip-1.15.0/mip/_version.py) HOT 1
- More verbose errors? HOT 3
- still logging when verbose=0 (on a recent version of CBC)
- Support Python 3.12
- Add py.typed marker HOT 1
- Infeasibility Issue in Python-MIP When Incrementing an Integer Constant HOT 2
- `add_constr` returns broken object when adding constraint without variables HOT 3
- help support mac arm HOT 2
- Constraint creation is not symmetric for combination variable and tensor
- Highs with python-mip is slow HOT 3
- how to get all or more solutions?
- Python 3.12 HOT 4
- upper bound not reported correctly in CBC Progress Callback
- Log output not displayed in Jupyter Notebook
- ERROR while running Cbc. Macos
- Tests fail to find the symbol Osi_getIntegerTolerance in lib/libCbcSolver.so
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-mip.