Hey guys.
Im trying to use gurobi in the matlab interface.
for i=1:ns
c2(:,i)=(T(:,:,i)*xk-h(:,i)+nuk(:,i))'*W(:,:,i)-(chik(i)+tk-sk(i)+eta(i))*q(:,i);
model.Q=sparse(Q2(:,:,i));%matrix of quadratic terms of the objective function
model.modelsense(i)='min';% minimizing or maximizing
model.obj=c2(:,i);%linear vector of the objective function
model.A=sparse(zeros(1,D2));%constrain matrix A A PROBAR CON MATRIZ VACIA []
model.rhs=0;%right hand vector of contraints A PROBAR CON MATRIZ VACIA []
model.sense='=';%kind of constraints
model.lb=0 * ones(D2,1); %lower bound of every variable assume non negativy if this line is absent
params.outputflag = 0;
result=gurobi(model,params);%solving the model
zk(:,:,i)=result.x;
clear params;
clear model;
end
the problem is when I try to parallel this with a parfor
parfor i=1:ns
c2(:,i)=(T(:,:,i)*xk-h(:,i)+nuk(:,i))'*W(:,:,i)-(chik(i)+tk-sk(i)+eta(i))*q(:,i);
model.Q=sparse(Q2(:,:,i));%matrix of quadratic terms of the objective function
model.modelsense='min';% minimizing or maximizing
model.obj=c2(:,i);%linear vector of the objective function
model.A=sparse(zeros(1,D2));%constrain matrix A A PROBAR CON MATRIZ VACIA []
model.rhs=0;%right hand vector of contraints A PROBAR CON MATRIZ VACIA []
model.sense='=';%kind of constraints
model.lb=0 * ones(D2,1); %lower bound of every variable assume non negativy if this line is absent
params.outputflag = 0;
result=gurobi(model,params);%solving the model
zk(:,:,i)=result.x;
clear params;
clear model;
end
I don't know how to use it.
Plz some help me