coin-or / pulp

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

PulpSolverError: Pulp: Error while trying to execute, use msg=True for more details #703

Open kaijing-zhang opened 10 months ago

kaijing-zhang commented 10 months ago

Hi Experts,

i use below scripts to load problem from JSON. ` import pulp as lp

d, loaded_problem = lp.LpProblem.fromJson('saved_problem.json') loaded_problem.solve() `

it shows

At line 1594 ENDATA Problem MODEL has 341 rows, 50 columns and 704 elements Coin0008I MODEL read with 0 errors Continuous objective value is 8.3122 - 0.00 seconds Cgl0003I 0 fixed, 0 tightened bounds, 15 strengthened rows, 0 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 10 strengthened rows, 0 substitutions Cgl0004I processed model has 39 rows, 21 columns (21 integer (0 of which binary)) and 126 elements Cutoff increment increased from 1e-05 to 0.9999 Cbc0012I Integer solution of 28 found by DiveCoefficient after 0 iterations and 0 nodes (0.01 seconds) Cbc0038I Full problem 39 rows 21 columns, reduced to 8 rows 11 columns Cbc0012I Integer solution of 20 found by RINS after 0 iterations and 0 nodes (0.01 seconds) terminate called after throwing an instance of 'CoinError' Exception in execute request:

then error out

could you please help me?

the saved_problem.json file is in the attachment. saved_problem.json

pchtsp commented 10 months ago

This seems an issue to report to the cbc repository. https://github.com/coin-or/Cbc

Having said that, the coefficients for your constraints seem to have way more decimal digits than you need. Consider rounding all the floats on your problem to a reasonable precision (e.g., 2 digits).

That could be the cause of the error.

kaijing-zhang commented 10 months ago

This seems an issue to report to the cbc repository. https://github.com/coin-or/Cbc

Having said that, the coefficients for your constraints seem to have way more decimal digits than you need. Consider rounding all the floats on your problem to a reasonable precision (e.g., 2 digits).

That could be the cause of the error.

thanks for your suggestion. but my coefficients for my constraints are all 1 or -1. such as: a6536 + a6537 + a6538 <= 30 a6536, a6537 a6538 and are variables. they coefficients are all 1

pchtsp commented 10 months ago

Well if you open the json file you shared in a text editor you will see "constant" values for some constraints that have maaany decimals.

kaijing-zhang commented 10 months ago

Well if you open the json file you shared in a text editor you will see "constant" values for some constraints that have maaany decimals.

Thanks a lot. i will try. how to send the case to CBC? same as my description here ans send the json to them?