Tomer
Tomer

Reputation: 1229

Using integer variable in pulp as binary

I have optimization problems with many integer variables x1,x2,x3... and I set many constraints on them and everything is fine. But now I have constraints that involve expression that treats them as binaries. For example:

(if x1 > 0 then 1 else 0)*someconst_1 + (if x2 > 0 then 1 else 0)*someconst_2 >= 0

Is there any alternative in pulp to code this constraint without declaring many binary variables - one for each integer variable ?

Upvotes: 0

Views: 332

Answers (1)

kur ag
kur ag

Reputation: 593

Based on the given information, there isn't a short way. Because each one will be dependent on integer variables. But if these are on equation levels, disjunctive and conjunctive normal forms can be useful for you.

Upvotes: 1

Related Questions