[Cbc] Multiplying two binary variables in the objective function

Tobias Stengel Tobias.Stengel at locom.de
Wed Oct 4 04:36:40 EDT 2017


Dear Bjorn,

observation: B1 * B2 == 1 iff B1 == 1 and B2 == 1 and 0 otherwise. So you can use a binary helper variable x = B1 <and> B2.
This can be modeled e.g.  by
x >= B1 + B2 – 1
x <= B1
x <= B2
x \in {0, 1}

then use x instead of B1*B2 in the objective.

Tobias

Von: Cbc [mailto:cbc-bounces at coin-or.org] Im Auftrag von Bjørn Sigurd Johansen (Spider Solutions AS)
Gesendet: Mittwoch, 4. Oktober 2017 10:26
An: John Forrest <john.forrest at fastercoin.com>; cbc at list.coin-or.org
Betreff: [Cbc] Multiplying two binary variables in the objective function


Dear CBC list / John,





Is it possible to multiply two binary variables in the objective function scaled with the same factor?

E.g.

MINIMIZE Obj:

+12.3 B1 * 12.3 B2

or

+12.3 B1 * + 12.3 B2



If binary variables are set through some sort of branching algorithm, perhaps it is possible?  But if the binary variables are set/estimated through some other mechanism, it might not be possible?



If possible, what is the exact syntax for doing this?



If not possible, I guess the option is to introduce a third binary B3, and set up the following constraints:

B3 <= B1

B3 <= B2

B3 >= B1 + B2 - 1

And then in the objective function use:

+12.3 B3

Correct / best option?





Best regards,

Bjorn

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20171004/7aef623e/attachment.html>


More information about the Cbc mailing list