Info

This question is closed. Reopen it to edit or answer.

Constraint for binary linear model

3 views (last 30 days)
Josh  Flohr
Josh Flohr on 5 May 2016
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi guys, If I have a 50x50 matrix of binary decision variables, is there a simple way to constrain the matrix so that only one row can become 1 and that the sum of columns=1?
Essentially I know that the answer can only appear in one row but I want all of the row to be used when the optimization occurs. Below is what I have to constrain it from only choosing a single positive integer from each column, now I want to ensure the single integers are in the same row.
x=zeros(50,50)
Ub=ones(50,50)
lb=x
a=ones(50,1)
Aeq=blkdiag(a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a);
beq=ones(1,50)
  1 Comment
Alan Weiss
Alan Weiss on 6 May 2016
I am not sure that I understand your problem. It sounds like you want exactly one row to be entirely 1, and all the other rows entirely 0. Is that correct? Please let us know.
Alan Weiss
MATLAB mathematical toolbox documentation

Answers (0)

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!