[Cbc] Multiplying two binary variables in the objective function

John Forrest john.forrest at fastercoin.com
Wed Oct 4 04:57:57 EDT 2017


Bjorn,

Probably simplest/best to make into Special Ordered Set of type 1 with 4 
variables

B1_0_B2_0, B1_1_B2_0, B1_0_B2_1, B1_1_B2_1

with objective values 0.0, 12.3, 12.3, 151.29

and constraint
B1_0_B2_0+B1_1_B2_0+B1_0_B2_1+B1_1_B2_1 == 1.0
(you could leave out B1_0_B2_0 and make <=, but probably better 
branching with ==)

and corresponding changes to coefficients in constraints.

That way you add 2 variables and 1 row which is probably better than 
adding 1 variable and 3 rows - and will be better for branching.

Depending on what you are trying to model, you could give weights to 
give better branching decisions.

John Forrest
On 02/10/17 07:10, Bjørn Sigurd Johansen (Spider Solutions AS) wrote:
> Dear CBC list,
>
> 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
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=hM8BKlgl1z5yzxrZnxtYfw_AEAZDyQOjfvWFs39qJLk&s=DDn3zh-jLSVoNRCQal3m7LVGxVLHAnUxaImDCAH-088&e=
>
>



More information about the Cbc mailing list