Contents
clear all;
loop through n
for n = 2:8
generate data A, b, c
A = toeplitz([1 2*10.^(1:n-1)],[1 zeros(1,n-1)]);
b = 100.^(0:1:n-1)';
c = 10.^(n-1:-1:0)';
solve using 2 pivot rules and output
opts.freq = 0;
for prule = 1:2
opts.prule = prule;
fprintf('\nn = %i, prule = %i: \n',n,prule)
solve_an_LP;
end
n = 2, prule = 1:
Iter 4: Obj = -1.00000000e+02
Optimal solution found.
obj value = 1.00000000e+02
Number of Iter = 4
Total CPU = 0.01 sec.
Prob. size [m, n] = [2 2]
n = 2, prule = 2:
Iter 4: Obj = -1.00000000e+02
Optimal solution found.
obj value = 1.00000000e+02
Number of Iter = 4
Total CPU = 0 sec.
Prob. size [m, n] = [2 2]
n = 3, prule = 1:
Iter 8: Obj = -1.00000000e+04
Optimal solution found.
obj value = 1.00000000e+04
Number of Iter = 8
Total CPU = 0 sec.
Prob. size [m, n] = [3 3]
n = 3, prule = 2:
Iter 6: Obj = -1.00000000e+04
Optimal solution found.
obj value = 1.00000000e+04
Number of Iter = 6
Total CPU = 0 sec.
Prob. size [m, n] = [3 3]
n = 4, prule = 1:
Iter 16: Obj = -1.00000000e+06
Optimal solution found.
obj value = 1.00000000e+06
Number of Iter = 16
Total CPU = 0 sec.
Prob. size [m, n] = [4 4]
n = 4, prule = 2:
Iter 10: Obj = -1.00000000e+06
Optimal solution found.
obj value = 1.00000000e+06
Number of Iter = 10
Total CPU = 0 sec.
Prob. size [m, n] = [4 4]
n = 5, prule = 1:
Iter 32: Obj = -1.00000000e+08
Optimal solution found.
obj value = 1.00000000e+08
Number of Iter = 32
Total CPU = 0.01 sec.
Prob. size [m, n] = [5 5]
n = 5, prule = 2:
Iter 16: Obj = -1.00000000e+08
Optimal solution found.
obj value = 1.00000000e+08
Number of Iter = 16
Total CPU = 0 sec.
Prob. size [m, n] = [5 5]
n = 6, prule = 1:
Iter 64: Obj = -1.00000000e+10
Optimal solution found.
obj value = 1.00000000e+10
Number of Iter = 64
Total CPU = 0.01 sec.
Prob. size [m, n] = [6 6]
n = 6, prule = 2:
Iter 26: Obj = -1.00000000e+10
Optimal solution found.
obj value = 1.00000000e+10
Number of Iter = 26
Total CPU = 0.01 sec.
Prob. size [m, n] = [6 6]
n = 7, prule = 1:
Iter 128: Obj = -1.00000000e+12
Optimal solution found.
obj value = 1.00000000e+12
Number of Iter = 128
Total CPU = 0.03 sec.
Prob. size [m, n] = [7 7]
n = 7, prule = 2:
Iter 42: Obj = -1.00000000e+12
Optimal solution found.
obj value = 1.00000000e+12
Number of Iter = 42
Total CPU = 0.01 sec.
Prob. size [m, n] = [7 7]
n = 8, prule = 1:
Iter 256: Obj = -1.00000000e+14
Optimal solution found.
obj value = 1.00000000e+14
Number of Iter = 256
Total CPU = 0.07 sec.
Prob. size [m, n] = [8 8]
n = 8, prule = 2:
Iter 68: Obj = -1.00000000e+14
Optimal solution found.
obj value = 1.00000000e+14
Number of Iter = 68
Total CPU = 0.01 sec.
Prob. size [m, n] = [8 8]
loop end
end