coin-or / pulp

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

Pulp: Error while trying to execute, use msg=True for more details (xxx) #670

Open kaijing-zhang opened 1 year ago

kaijing-zhang commented 1 year ago

I am new to pulp. when use pulp with CBC solver. it shows

At line 2 NAME          MODEL
At line 3 ROWS
At line 29 COLUMNS
At line 109 RHS
At line 134 BOUNDS
At line 143 ENDATA
Problem MODEL has 24 rows, 8 columns and 55 elements
Coin0008I MODEL read with 0 errors
Continuous objective value is 4.38361 - 0.00 seconds
Cgl0003I 0 fixed, 0 tightened bounds, 7 strengthened rows, 0 substitutions
Cgl0003I 0 fixed, 0 tightened bounds, 4 strengthened rows, 0 substitutions
Cgl0004I processed model has 9 rows, 6 columns (6 integer (0 of which binary)) and 28 elements
Cutoff increment increased from 1e-05 to 0.9999
Cbc0012I Integer solution of 7 found by DiveCoefficient after 0 iterations and 0 nodes (0.00 seconds)
Cbc0038I Full problem 9 rows 6 columns, reduced to 0 rows 0 columns
Cbc0012I Integer solution of 6 found by RINS after 0 iterations and 0 nodes (0.00 seconds)
terminate called after throwing an instance of 'CoinError'

then error out with: "pulp.apis.core.PulpSolverError: Pulp: Error while trying to execute, use msg=True for more details (xxx)"

seems it is caused by code:


        if cbc.wait() != 0:
            if pipe:
                pipe.close()
            raise PulpSolverError(
                "Pulp: Error while trying to execute, use msg=True for more details"
                + self.path
            )

how to solve this problem

my lp is


MINIMIZE
1*x34638 + 1*x34639 + 1*x34640 + 1*x34818 + 1*x34819 + 1*x34820 + 1*x34821 + 1*x34822 + 0
SUBJECT TO
_C1: x34638 + x34639 + x34640 <= 32
_C2: x34638 >= -0.725468
_C3: x34638 + x34639 >= -0.016388
_C4: x34638 + x34639 + x34640 >= 0.187616
_C5: x34639 >= -0.29092
_C6: x34639 + x34640 >= -0.086916
_C7: x34640 >= -0.795996
_C8: x34818 + x34819 + x34820 + x34821 + x34822 <= 32
_C9: x34818 >= -0.794828
_C10: x34818 + x34819 >= 0.69024
_C11: x34818 + x34819 + x34820 >= 3.06144
_C12: x34818 + x34819 + x34820 + x34821 >= 3.991988
_C13: x34818 + x34819 + x34820 + x34821 + x34822 >= 4.195992
_C14: x34819 >= 0.485068
_C15: x34819 + x34820 >= 2.856268
_C16: x34819 + x34820 + x34821 >= 3.786816
_C17: x34819 + x34820 + x34821 + x34822 >= 3.99082
_C18: x34820 >= 1.3712
_C19: x34820 + x34821 >= 2.301748
_C20: x34820 + x34821 + x34822 >= 2.505752
_C21: x34821 >= -0.069452
_C22: x34821 + x34822 >= 0.134552
_C23: x34822 >= -0.795996
_C24: x34640 - x34822 = 0

VARIABLES
0 <= x34638 Integer
0 <= x34639 Integer
0 <= x34640 Integer
0 <= x34818 Integer
0 <= x34819 Integer
0 <= x34820 Integer
0 <= x34821 Integer
0 <= x34822 Integer

how to solve this error? Pulp 2.4 Python 3.8.0

Thanks!