rhs structure

353 views
Skip to first unread message

Nicanor Bailez

unread,
Dec 3, 2014, 1:06:41 PM12/3/14
to gur...@googlegroups.com
I'm trying to minimize a quadratic function, considering an upper and a lower limit, so I'm struggling to correctly write the right hand side line of the code.

clear model;

names={'x1','x2','x5','x8','x11','x13'};

model.varnames=names;

model.Q=sparse(Q);

model.A=sparse(Sg);

model.obj=(L);

negFl=-Fl;

model.rhs=[Fu; negFl];

model.sense='<';


Gurobi says: Incorrect size(model.rhs)

I'm trying to figure out what's wrong in the model.rhs and how to do it right.


Thanks!



Christopher Maes

unread,
Dec 3, 2014, 3:22:58 PM12/3/14
to gur...@googlegroups.com
> model.A=sparse(Sg);
> model.rhs=[Fu; negFl];
> Gurobi says: Incorrect size(model.rhs)
>
> I'm trying to figure out what's wrong in the model.rhs and how to do it
> right.

Take a look at

http://www.gurobi.com/documentation/6.0/reference-manual/matlab_gurobi

It explains the requirements for model.rhs:

model.rhs: The right-hand side vector for the linear constraints. You
must specify one value for each row of A.

My guess is that the number of rows in A is not the same as the length
of your rhs vector. You can test this in MATLAB via the command:

>> size(model.A, 1) == size(model.rhs, 1)

Hope that helps,
Chris
Reply all
Reply to author
Forward
0 new messages