MATLAB Answers

0

Can I set restrictions on the output matrix from "linprog" before solving?

Asked by Austin Brehm on 31 Oct 2019
Latest activity Edited by Matt J
on 31 Oct 2019
Ex: OUTPUT = X = [0.2 0.2 0.2 0.2 0.2; 0.2 0.2 0.2 0.2 0.2; 0.2 0.2 0.2 0.2 0.2]
DESIRED OUTPUT = X = [1 0 0 0 0; 0 0 1 0 0; 0 1 0 0 0]
I know that you can set limits (lb - lower bound, ub - upperbound) on specific values of the output matrix.
So for this example, lb = 0 and ub = 1.
Is it possible to set up a loop where if one cell of a matrix is allocated, the rest of the cells in that row are set to zero?

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Matt J
on 31 Oct 2019
Edited by Matt J
on 31 Oct 2019

If X is constrained to be binary (using intlinprog rather than linprog), then this condition is equivalent to the linear inequality constraint,
sum(X,2)<=1;

  0 Comments

Sign in to comment.