coin-or / pulp

A python Linear Programming API
http://coin-or.github.io/pulp/
Other
2.11k stars 388 forks source link

pulp.solvers.PulpSolverError: Pulp: Error while trying to execute cbc.exe #282

Closed totlot-dev-badger closed 4 years ago

totlot-dev-badger commented 4 years ago

Hello evrybody I get this error in the VS code console: pulp.solvers.PulpSolverError: Pulp: Error while trying to execute C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pulp\solverdir\cbc\win\32\cbc.exe

However when I do what @pchtsp says: PATH_TO_PYTHON/Lib/site-packages/pulp/solverdir/cbc/win/64/cbc.exe PATH_TO_MPS_FILE/error_case.mps it seems to work, no errors come out.

`Welcome to the CBC MILP Solver Version: 2.9.0 Build Date: Feb 12 2015

command line - cbc.exe C:\Users\User\Opti_ballast.mps (default strategy 1) At line 2 NAME Ballast_to_Laden_Optimization At line 3 ROWS At line 9038 COLUMNS At line 9434856 RHS At line 9443890 BOUNDS At line 11330861 ENDATA Problem Ballast_to_Laden_Optimization has 9033 rows, 1886970 columns and 3764907 elements Coin0008I Ballast_to_Laden_Optimization read with 0 errors Continuous objective value is 1.99588e+007 - 155.96 seconds` However the code runs without error with a lower number of variables. My question is the following, what is the highest amount of variables/ elements you can give to the solver? I believe it depends on the complexity of the solving

Thanks if by any chance you can help

pchtsp commented 4 years ago

Hey, Are you sure you're using the same cbc in both times? You should run just to be sure:

C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pulp\solverdir\cbc\win\32\cbc.exe C:\Users\User\Opti_ballast.mps

Franco

totlot-dev-badger commented 4 years ago

yep i've run it and it works perfectly, it says Optimal Solution found. It's just not working on VSCode when I run prob.solve() When I feed cbc.exe with the MPS file on the command prompt and it finds the solution, is there a file where the solution is stored where I could grab the values Thanks a lot for your help!!

totlot-dev-badger commented 4 years ago

It works on VSCode with a small number of variables and the MPS command prompt trick raises no error Below is what happens on the cmd prompt `C:\Users\Username\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\pulp\solverdir\cbc\win\64>cbc.exe "C:\Users\Username\Ballast to Laden Optimization.mps" Welcome to the CBC MILP Solver Version: 2.9.0 Build Date: Feb 12 2015

command line - cbc.exe C:\Users\DokLot\Ballast to Laden Optimization.mps (default strategy 1) At line 2 NAME Ballast_to_Laden_Optimization At line 3 ROWS At line 3747 COLUMNS At line 6898589 RHS At line 6902332 BOUNDS At line 8283626 ENDATA Problem Ballast_to_Laden_Optimization has 3742 rows, 1381293 columns and 2762586 elements Coin0008I Ballast_to_Laden_Optimization read with 0 errors Continuous objective value is 8.19387e+006 - 200.89 seconds Cgl0004I processed model has 3740 rows, 1380733 columns (1380733 integer (1380733 of which binary)) and 2761466 elements Cbc0038I Initial state - 0 integers unsatisfied sum - 0 Cbc0038I Solution found of 8.19387e+006 Cbc0038I Before mini branch and bound, 1380733 integers at bound fixed and 0 continuous Cbc0038I Mini branch and bound did not improve solution (497.62 seconds) Cbc0038I After 497.90 seconds - Feasibility pump exiting with objective of 8.19387e+006 - took 5.30 seconds Cbc0012I Integer solution of 8193872.6 found by feasibility pump after 0 iterations and 0 nodes (498.47 seconds) Cbc0001I Search completed - best objective 8193872.632211004, took 0 iterations and 0 nodes (499.87 seconds) Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost Cuts at root node changed objective from 8.19387e+006 to 8.19387e+006 Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)

Result - Optimal solution found

Objective value: 8193872.63221100 Enumerated nodes: 0 Total iterations: 0 Time (CPU seconds): 511.03 Time (Wallclock seconds): 511.03

Total time (CPU seconds): 524.12 (Wallclock seconds): 524.12

C:\Users\Username\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\pulp\solverdir\cbc\win\64>`

totlot-dev-badger commented 4 years ago

I just noticed it isn't the same cbc.exe, my Python code is using the one in the folder 32, how could I make him switch to 64 since I have Windows 64 bits?

TornadoContre commented 4 years ago

Hi @totlot-dev-badger , did you solve your problem? And how did you do it? Thanks!

totlot-dev-badger commented 4 years ago

I went deep in the code and changed 32 into 64 everywhere i could and it worked, and with a stronger machine it works also

pchtsp commented 4 years ago

In @totlot-dev-badger it appears that the 32-bit version of python was being used. That's why 32-bit cbc was being used, I think. If you use 64-bit python, it should use the 64-bit version of cbc...

TornadoContre commented 4 years ago

I'm no expert but after some research I realized that my machine have a 32 bit architecture and I suppose that it's impossible that CBC work with 64 bit version.

pchtsp commented 4 years ago

since the original issue is solved, I'm closing it.