Defining array contents - order doesn't matter - Linear programming problem

4 ビュー (過去 30 日間)
Matt Newman
Matt Newman 2019 年 3 月 15 日
コメント済み: Matt J 2019 年 3 月 17 日
Hi All,
I'm attempting to solve a linear programming problem in the for Ax = B, that I'm hoping to plug into the intlinprog function. The problem I'm having is defining the B array. I know what the contents should be, but I will not know what order they will be in.
For example: A a 16x100 matrix, x equals a 100x1 matrix, and in turn B equals a 16x1 matrix. Lets say I know the contents of B should contain a 3, another 3, and 14 zeros, but I do not know what order those will be in. Is there any built in function to define the B matrix in such fashion? If not how else could a define such a matrix?
Thanks for any help anyone can provide!

回答 (1 件)

Matt J
Matt J 2019 年 3 月 16 日
編集済み: Matt J 2019 年 3 月 16 日
It does not matter what order the B(i) are in, as long as the ordering of the rows A(i,;) matches B(i).
  2 件のコメント
Matt Newman
Matt Newman 2019 年 3 月 16 日
So i know what the A matrix is, but i dont initially know what the X matrix will be, so i cant know the proper order. The program will iterate through various X options, but i know the B vector then will need to consist of 3,3, and 14 zeros in some order, which is dependent on which x matrix is used, which is based off other constraints being enforced.
Matt J
Matt J 2019 年 3 月 17 日
The order of X(i) and B(i) are unrelated to each other. The order of the columns A(:,i) are related to X(i), but it shouldn't concern you. If you permute the columns of A, then the solver will give you correspondingly permuted X(i).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by