how to sparse matrix

In the example given under Intlinprog (factory, warehouse and sales outlet-matlab documenttation), one of the command to specify the sparse matrix is given as :Aineq = spalloc(P*F + W,matwid,P*F*W + S*W); i would please try to understand how the parameters for rows, and nonzero values have been arrived i.e P*F + W and P*F*W + S*W

回答 (1 件)

Massimo Zanetti
Massimo Zanetti 2016 年 10 月 10 日
編集済み: Massimo Zanetti 2016 年 10 月 10 日

1 投票

there are
F = floor(f*N2); % number of factories
W = floor(w*N2); % number of warehouses
S = floor(s*N2); % number of sales outlets
and
P = 20; % 20 products
Therefore, to set up the linear system that defines inquality constraints they first allocate sparse matrix place
Aineq = spalloc(P*F + W,matwid,P*F*W + S*W)
and later they fill in the matrix.

1 件のコメント

Sachin Kamble
Sachin Kamble 2016 年 10 月 10 日
Massimor Thanks for your immediate reply.My question was pertaining to why? (P*F +W) for the rows and (P*F*W + S*W)for maximum non zeros. I understand that these are the variables defined in the problem. i am a little weak in permutations and combinations. i will be glad if you can please help me out. Can you please go through the codes and help me. please

この質問は閉じられています。

製品

質問済み:

2016 年 10 月 10 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by