Matlab で Gurobi ソルバーを使用したいのですが、必要な行列 (qrow と qcol) の計算方法がわかりません。
ご参考までに、ドキュメントに記載されている例をコピーしています。
0.5 x^2 - xy + y^2 - 2x - 6y
の対象となる
x + y <= 2
-x + 2y <= 2, 2x + y <= 3, x >= 0, y >= 0
c = [-2 -6]; % objective linear term
objtype = 1; % minimization
A = sparse([1 1; -1 2; 2 1]); % constraint coefficients
b = [2; 2; 3]; % constraint right-hand side
lb = []; % [ ] means 0 lower bound
ub = []; % [ ] means inf upper bound
contypes = '$<<
vtypes = [ ]; % [ ] means all variables are continuous
QP.qrow = int32([0 0 1]); % indices of x, x, y as in (0.5 x^2 - xy + y^2); use int64 if sizeof(int) is 8 for you system
QP.qcol = int32([0 1 1]); % indices of x, y, y as in (0.5 x^2 - xy + y^2); use int64 if sizeof(int) is 8 for you system
QP.qval = [0.5 -1 1]; % coefficients of (0.5 x^2 - xy + y^2)
決定変数が 4 つある場合、決定変数 x_1、x_2、x_3、x_4 のインデックスとして 0,1,2,3 を使用する必要があるということですか?
ありがとう
注: mathurl.com を使用しようとしましたが、適切な形式でラテックス テキストとして表示されることを示す方法がわかりません。表記失礼します。