or-fusion / pyomo_simplemodel

An extension of Pyomo that defines a simple modeling class that is similar to PuLP
Other
6 stars 6 forks source link

Binary variables takes continues values after running the optimizer #2

Closed mohanadkaleia closed 6 years ago

mohanadkaleia commented 6 years ago

Hello, I run the example of newsvendor problem from this page: http://pyomocontrib-simplemodel.readthedocs.io/en/latest/newsvendor.html#simplemodel-formulation

But the results are not binary, here:

Status = optimal x[hammer] = 1.000000 x[screwdriver] = 1.000000 x[towel] = 1.000000 x[wrench] = 0.285714 Objective = 25.857143

Why x[wrench] took 0.28 although the x defined as a binary?

Note I used ipopt for the solver Thank you

whart222 commented 6 years ago

The ipopt solver does not directly handle binary variables. Instead, when you send a model with binary variables to ipopt it relaxes the integrality constraint by using a continuous variable with bounds 0 and 1.

On Thu, Nov 9, 2017 at 6:02 PM, Mohanad Kaleia notifications@github.com wrote:

Hello, I run the example of newsvendor problem from this page: http://pyomocontrib-simplemodel.readthedocs.io/en/latest/newsvendor.html# simplemodel-formulation

But the results are not binary, here:

Status = optimal x[hammer] = 1.000000 x[screwdriver] = 1.000000 x[towel] = 1.000000 x[wrench] = 0.285714 Objective = 25.857143

Why x[wrench] took 0.28 although the x defined as a binary?

Note I used ipopt for the solver Thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Pyomo/pyomocontrib_simplemodel/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AAsb-NDwdGJOPDGXXsFgdfxpYSMXvL9Sks5s06C0gaJpZM4QY7D3 .

mohanadkaleia commented 6 years ago

:( I wasted a whole day to compile ipopt Do you have suggestions for a solver that can handle non-linear problems and support binary variables?

Thanks

whart222 commented 6 years ago

There isn't a single "best" solver for MINLP problems. COIN-OR includes pre-built binaries for the Couenne solver.