pulp icon indicating copy to clipboard operation
pulp copied to clipboard

Infeasible using PULP_CBC_CMD

Open etiennecallies opened this issue 2 years ago • 2 comments
trafficstars

Hi,

I'm using PuLP==2.7.0 (tried also to install pulp from source).

I got Infeasible status on this solvable problem :

    lp_problem = LpProblem('my_problem', LpMinimize)

    x_0 = LpVariable('x_0', lowBound=0, upBound=1, cat='Integer')
    x_1 = LpVariable('x_1', lowBound=0, upBound=1, cat='Integer')
    x_2 = LpVariable('x_2', lowBound=0, upBound=1, cat='Integer')
    c_0 = LpVariable('c_0', lowBound=0, upBound=1, cat='Integer')
    c_1 = LpVariable('c_1', lowBound=0, upBound=1, cat='Integer')

    # objective
    lp_problem += c_0 + c_1

    # constraints
    lp_problem += x_0 + c_1 == 1

    lp_problem += x_0 + c_0 >= 1
    lp_problem += x_1 + c_1 <= 1
    lp_problem += c_0 + c_1 <= 1

    lp_problem += x_2 == 1

    lp_problem += 9000 * x_1 + 7200 * x_2 + 10800 * c_1 >= 16200

    print(lp_problem)
    lp_problem.solve(PULP_CBC_CMD(msg=True))
    print(LpStatus[lp_problem.status])

It is indeed solvable if all x are 1 and c are 0. Whenever I try to reduce it , I got Optimal. For example when I use this constraint :

# lp_problem += 9000 * x_1 + 7200 * x_2 + 10800 * c_1 >= 16200
lp_problem += 900 * x_1 + 720 * x_2 + 1080 * c_1 >= 1620

Or even when I rename some variable.

Am I doing sth wrong, or is there a bug?

Details for the issue

What did you expect to see?

I expected the problem to be solvable.

What did you see instead?

I got Infeasible.

Useful extra information

The info below often helps, please fill it out if you're able to. :)

What operating system are you using?

  • [ ] Windows: ( version: ___ )
  • [x] Linux: ( distro: ___ )
  • [x] Mac OS: ( version: ___ )
  • [ ] Other: ___

I'm using python version:

  • [ ] 2.7
  • [ ] 3.4
  • [ ] 3.5
  • [ ] 3.6
  • [x] Other: 3.9.11

I installed PuLP via:

  • [x] pypi (python -m pip install pulp)
  • [ ] github (python -m pip install -U git+https://github.com/coin-or/pulp)
  • [ ] Other: ___ (conda?)

Did you also

  • [x] Tried out the latest github version: https://github.com/coin-or/pulp
  • [x] Searched for an existing similar issue: https://github.com/coin-or/pulp/issues?utf8=%E2%9C%93&q=is%3Aissue%20

Thanks

etiennecallies avatar Jun 16 '23 07:06 etiennecallies

Indeed, if I try with CPLEX it returns optimal.

I recommend you to transfer this issue to the cbc team in https://github.com/coin-or/Cbc Ideally, by sharing the mps file using lp_problem.writeMPS("error.mps").

pchtsp avatar Jan 16 '24 07:01 pchtsp

Hi @pchtsp ! Thanks for having looked at it. I just submitted this issue on CBC repo: https://github.com/coin-or/Cbc/issues/632

etiennecallies avatar Jan 16 '24 09:01 etiennecallies