Does the order affect LP performance
The setup and result are
1. Run the m file as it is, the result shows time1 is roughly time2 ✖ 10;
2. Exchange the orders of two functions, that is, first run x = linprog(f,[],[],Aeq, beq, lb, ub, opts)
and then run x = linprog(f,[],[],Aeq, beq, lb, ub);, the results show that time1 roughly equals to time2;
3. first run x = linprog(f,[],[],Aeq, beq, lb, ub), second run x = linprog(f,[],[],Aeq, beq, lb, ub, opts), third run x = linprog(f,[],[],Aeq, beq, lb, ub)
The results show that time1 is roughly time2 ✖ 10, time3 roughly time2 ✖ 2;
4. First run x = linprog(f,[],[],Aeq, beq, lb, ub, opts), second x = linprog(f,[],[],Aeq, beq, lb, ub), third x = linprog(f,[],[],Aeq, beq, lb, ub, opts)
The results show that time1 roughly equals to time2, time2 roughly time3 ✖ 2 .
I am wondering why the order affects the results so much. Could you please help me with this?
The m file goes like this:
clear all
f = ones(1250,1);
Aeq = randi([-100,100],625,1250);
beq = zeros(625,1);
lb = zeros(1250,1);
ub = Inf*ones(1250,1);
tic
x = linprog(f,[],[],Aeq, beq, lb, ub);
time1 = toc;
opts = optimoptions('linprog','Preprocess','none');
tic;
x = linprog(f,[],[],Aeq, beq, lb, ub, opts);
time2 = toc;
times = [time1 time2]
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Are you using the linprog function in the Gurobi examples directory or Matlab's built-in one?
With the built-in one, I can reproduce your running times, with Gurobi's I cannot.
0
Post is closed for comments.
Comments
2 comments