Sie sind auf Seite 1von 4

HOMEWORK

AKINO (748791)

3.21:

MATLAB CODE:
clc
clear all
f=[1;-1;3;-3];
A=[-4 4 3 -3;
1 -1 1 -1;
1 -1 -4 4];
b=[12;7;2];
lb=zeros(3,1);
Aeq=[];
beq=[];
options=optimset('Largescale','off','simplex','on');
[x,fval,exitflag,output]=linprog(f,A,b,Aeq,beq,lb,[],[],optimset('Display','iter'))
OUTPUT:
Warning: Length of lower bounds is < length(x); filling in missing lower bounds with -Inf.
> In checkbounds at 34
In linprog at 238
Residuals: Primal
Dual
Duality Total
Infeas Infeas
Gap
Rel
A*x-b A'*y+z-f x'*z
Error
--------------------------------------------------Iter 0: 5.28e+02 9.26e+00 2.75e+03 3.00e+02
Iter 1: 2.88e+01 3.23e-01 1.50e+02 2.05e+00
Iter 2: 2.02e-09 4.64e-03 9.66e+00 7.27e-01
Iter 3: 6.24e-09 3.18e-04 4.41e-01 3.93e-02
Iter 4: 9.63e-09 1.87e-08 2.48e-05 2.27e-06
Iter 5: 5.42e-10 1.87e-13 2.49e-10 3.86e-11
Optimization terminated.
x = 124.4019
128.5558
95.7892
97.3277
fval = -8.7692
exitflag = 1
output = iterations: 5
algorithm: 'interior-point'
cgiterations: 0
message: 'Optimization terminated.'
constrviolation: 2.8535e-10
firstorderopt: 3.2925e-10
3.28:

MATLAB CODE:
clc
clear all
f=[1;-4];
A=[-1 1;
45;
5 -2;
5 2];
b=[4;45;20;10];
lb=zeros(4,1);
Aeq=[];
beq=[];
options=optimset('Largescale','off','simplex','on');
[x,fval,exitflag,output]=linprog(f,A,b,Aeq,beq,lb,[],[],optimset('Display','iter'))
OUTPUT:
Warning: Length of lower bounds is > length(x); ignoring extra bounds.
> In checkbounds at 28
In linprog at 238
Residuals: Primal
Dual
Duality Total
Infeas Infeas
Gap
Rel
A*x-b A'*y+z-f x'*z
Error
--------------------------------------------------Iter 0: 1.30e+03 9.76e+00 1.75e+03 3.00e+02
Iter 1: 1.76e+02 1.35e-15 1.86e+02 3.49e+00
Iter 2: 6.57e+00 1.42e-14 2.46e+01 4.88e-01
Iter 3: 1.47e-14 4.97e-16 8.52e-01 4.84e-02
Iter 4: 5.10e-15 5.00e-16 8.84e-03 5.25e-04
Iter 5: 1.61e-14 5.00e-16 4.59e-07 2.72e-08
Iter 6: 1.02e-14 1.11e-16 4.59e-14 2.95e-15
Optimization terminated.
x = 0.2857
4.2857
fval = -16.8571
exitflag = 1
output = iterations: 6
algorithm: 'interior-point'
cgiterations: 0
message: 'Optimization terminated.'
constrviolation: 0
firstorderopt: 1.7510e-14
3.36:

MATLAB CODE:
clc
clear all
f=[5;2];
A=[3 4;
1 -1;
-1 -4;
-3 -1];
b=[24;3;-4;-3];
lb=zeros(4,1);
Aeq=[];
beq=[];
options=optimset('Largescale','off','simplex','on');
[x,fval,exitflag,output]=linprog(f,A,b,Aeq,beq,lb,[],[],optimset('Display','iter'))
OUTPUT:
Warning: Length of lower bounds is > length(x); ignoring extra bounds.
> In checkbounds at 28
In linprog at 238
Residuals: Primal
Dual
Duality Total
Infeas Infeas
Gap
Rel
A*x-b A'*y+z-f x'*z
Error
--------------------------------------------------Iter 0: 9.26e+02 6.12e+00 2.20e+03 7.00e+02
Iter 1: 2.55e-13 2.22e-15 8.02e+01 1.16e+00
Iter 2: 2.70e-14 1.78e-15 9.31e+00 8.82e-01
Iter 3: 3.48e-13 9.42e-16 4.18e+00 7.06e-01
Iter 4: 1.01e-14 3.18e-14 1.23e+00 2.09e-01
Iter 5: 2.51e-13 2.22e-16 2.56e-01 4.82e-02
Iter 6: 7.12e-15 8.88e-16 1.58e-04 2.99e-05
Iter 7: 1.60e-15 8.88e-16 7.88e-09 1.49e-09
Optimization terminated.
x =0.7273
0.8182
fval = 5.2727
exitflag =1
output = iterations: 7
algorithm: 'interior-point'
cgiterations: 0
message: 'Optimization terminated.'
constrviolation: 0
firstorderopt: 1.5635e-09

MATLAB CODE:
clc
clear all
f=[-14.36;-33.08;-112.32;-1023.20];

A=[0.088995 2.66984 10.67937 106.793650 ;


2.14815 6.44444 25.77778 257.77778;
0.00153 0.00460 0.01841 0.18413;
0.00614 0.01841 0.07365 0.73651;
0.02762 0.08286 0.33143 3.31429];
b=[16820;40600;29;116;522];
lb=zeros(5,1);
Aeq=[];
beq=[];
options=optimset('Largescale','off','simplex','on');
[x,fval,exitflag,output]=linprog(f,A,b,Aeq,beq,lb,[],[],optimset('Display','iter'))
OUTPUT:
Warning: Length of lower bounds is > length(x); ignoring extra bounds.
> In checkbounds at 28
In linprog at 238
Residuals: Primal
Dual
Duality Total
Infeas Infeas
Gap
Rel
A*x-b A'*y+z-f x'*z
Error
--------------------------------------------------Iter 0: 1.51e+02 1.63e+02 1.93e+05 1.64e+05
Iter 1: 2.36e-13 1.65e+01 1.77e+04 2.38e-01
Iter 2: 6.83e-12 1.37e+01 5.93e+03 2.66e-01
Iter 3: 5.02e-11 1.11e+01 4.25e+03 3.43e-01
Iter 4: 1.43e-08 1.14e-13 9.61e+04 3.52e-01
Iter 5: 1.40e-08 1.15e-13 3.42e+04 1.25e-01
Iter 6: 6.63e-09 2.43e-10 7.29e+03 2.67e-02
Iter 7: 2.10e-10 2.29e-13 1.90e+02 6.99e-04
Iter 8: 1.46e-08 2.94e-14 1.52e+00 5.61e-06
Iter 9: 1.74e-09 1.08e-14 1.61e-05 5.84e-11
Optimization terminated.
x =1.0e+04 *
1.8893
0.0000
0.0000
0.0000
fval = -2.7130e+05
exitflag =1
output = iterations: 9
algorithm: 'interior-point'
cgiterations: 0
message: 'Optimization terminated.'
constrviolation: 0
firstorderopt: 2.7371e-06
maxvalue=-fval
maxvalue = 2.7130e+05

Das könnte Ihnen auch gefallen