What is the best way to represent a binary linearizing variable in MATLAB while doing optimization?
Show older comments
I am trying to represent a constraint that contains a binary linearizing variable z where z=x_i⋅x_j and x is a n dimensional vector. In my original formulation x is used as variable in the optimization functions. Can anyone please help, how the constraint can be represented in MATLAB?
7 Comments
Walter Roberson
on 1 Mar 2018
Which optimizer?
Do I understand correctly that x consists entirely of 0 and 1? I am not clear on the linearizing part: does it mean that exactly one value is set? Or does it mean a(i) *a(j) contributes to the sum only if x(i) and x(j) are both 1?
Md Enamul Haque
on 1 Mar 2018
Walter Roberson
on 1 Mar 2018
That reminds me of a minmax problem, https://www.mathworks.com/help/optim/ug/fminimax.html and in any case appears to be mixed integer programming; https://www.mathworks.com/help/optim/ug/intlinprog.html -- looks like binary integer programming, which is a subset of intlinprog (but used to have its own function.)
Well, except I don't see what z is.
Md Enamul Haque
on 1 Mar 2018
Walter Roberson
on 1 Mar 2018
There is a hack you can use with ga or gamultiobj. Normally they do not permit you to use integer constraints with nonlinear constraints. However, what you can do is specify nonlinear constraints and do not tell it you want integer constraints, but supply custom initialization and mutation and crossover that "just happen" to only use integer values.
Md Enamul Haque
on 1 Mar 2018
Edited: Md Enamul Haque
on 1 Mar 2018
Walter Roberson
on 1 Mar 2018
I have not implemented it myself.
Sorry, I need to head to sleep now.
Answers (0)
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!