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

1 回表示 (過去 30 日間)
Austin Brehm
Austin Brehm 2019 年 10 月 31 日
編集済み: Matt J 2019 年 10 月 31 日
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?

回答 (1 件)

Matt J
Matt J 2019 年 10 月 31 日
編集済み: Matt J 2019 年 10 月 31 日
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;

カテゴリ

Help Center および File ExchangeLinear Programming and Mixed-Integer Linear Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by