I want to use Gurobi solver in Matlab, but I don't know how to calculate the required matrices (qrow and qcol). For your reference I am copying the example provided in documentation. 0.5 x^2  xy + y^2  2x  6y c = [2 6]; objective linear term objtype = 1; minimization A = sparse([1 1; 1 2; 2 1]); % constraint coefficients b = [2; 2; 3]; % constraint righthand 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) Does it mean that if I have 4 decision varaibles than i should use 0,1,2,3 as indices for my decision variables x_1, x_2, x_3, x_4.? Thanks Note: I tried to use mathurl.com but I don't get how to write in proper format show that it will appear as latex text. Sorry for the notation. asked 11 Mar '11, 23:35 Shailesh 
I'm not sure this is the right forum to ask questions about usage of a particular piece of software i.e. Gurobi; try this mailing list instead: http://groups.google.com/group/gurobi That said, it seems to me that qrow and qcol are interchangeable. The quadratic expression is obtained through a elementwise multiplication of qrow, qcol and qval. For instance, suppose we have the following expression (where the variables are x0, x1, x2 and x3):
From the instructions given, I would write the coefficients in
And
If I would assume then that the quadratic part of the objective is then reconstructed as follows:
where x is some vector with 0...n indexing (n being the number of terms minus 1). answered 12 Mar '11, 04:10 Gilead ♦ Nothing wrong with questions on particular software, though I agree that a gurobi specific group might work better.
(12 Mar '11, 09:09)
Michael Trick ♦♦
Thank you very much for the detailed explanation.
(12 Mar '11, 20:39)
Shailesh
