[Cbc] Multiplying two binary variables in the objective function

Bjørn Sigurd Johansen (Spider Solutions AS) bjorn.sigurd.johansen at spidersolutions.no
Wed Oct 4 04:44:25 EDT 2017


Thx :-)

This was my suggestion too.  So, I assume that multiplying two binary variables in objective function not is legal in COIN-OR MILP model.

And using
+ 12.3 * x
in the objective function should be OK, I assume.


Best, Bjorn

From: Tobias Stengel [mailto:Tobias.Stengel at locom.de]
Sent: onsdag 4. oktober 2017 10:37
To: Bjørn Sigurd Johansen (Spider Solutions AS) <bjorn.sigurd.johansen at spidersolutions.no>; cbc at list.coin-or.org
Subject: AW: Multiplying two binary variables in the objective function

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<mailto:john.forrest at fastercoin.com>>; cbc at list.coin-or.org<mailto: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/ac1ab31a/attachment-0001.html>


More information about the Cbc mailing list