I am not getting expected results from Gurobi in Matlab!
AnsweredHi,
I am solving a linear optimization problem in Matlab using 1-'Linprog' of Matlab, and 2-Gurobi in Matlab. All elements (Aeq, beq, A, b, ...) are identical, but results that I am getting from Gurobi are not expected. The flag in both solvers is showing that both of them are achieving the Global optimum. Could you please help me to solve this issue?
Thanks!
...
l_bound = []; u_bound = [];
% Matlab's Linprog
options = optimoptions('linprog','Algorithm','interior-point');
[x,fval,exitflag,output,lambda] = linprog(f_mat,A_ineq,b_ineq,A_eq,b_eq,l_bound,u_bound,options);
% Gurobi in Matlab
A = [A_ineq ; A_eq];
b = [b_ineq ; b_eq];
model.A = sparse(A);
model.obj = f_mat;
model.rhs = b;
model.vtype = 'C';
model.modelsense = 'min';
model.sense = [repmat('<',size(A_ineq,1),1) ; repmat('=',size(A_eq,1),1)]';
params = [];
% gurobi_write(model, 'model_sh.lp');
% params.Presolve = 0;
% params.outputflag = 0;
% params.Aggregate = 0;
result = gurobi(model, params);
0
-
Hi Sina,
You should write out both formulations as LP file and then compare them to each other and to the mathematical formulations they should describe.
Best regards,
Matthias0
Please sign in to leave a comment.
Comments
1 comment