hw3sol - EGM6365 Homework#3 1 A linear programming problem...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EGM6365 Homework #3 1. A linear programming problem is given as Maximize f = 2 x1 + 5 x2 Subject to 3 x1 + 2 x2 ≤ 12 2 x1 + 3x2 ≥ 6 (1) x1 ≥ 0, x2 unrestricted (i) (ii) Solve Eq. (1) using MATLAB. Convert Eq. (1) into the standard form and solve the standards problem using MATLAB. Compare two results. (i) Original Problem >> f=[-2; -5]; >> A=[3 2;-2 -3]; >> b=[12; -6]; >> lb=[0; -inf]; >>[x,fval,exitflag,output,lambda]=linprog(f,A,b,,,lb) x = [0, 6] f = -30 exitflag = 1 output = iterations: 5 cgiterations: 0 algorithm: 'lipsol' Thus, the optimum point is x* = (0, 6) and the value of the objective function is f* = 30. (ii) Standard Problem Let new design variable X = [x1, y1, y2, s1, s2], where x2 = y1 – y2. >> >> >> >> >> f = [-2; -5; 5; 0; 0]; Aeq = [3 2 -2 1 0; 2 3 -3 0 -1]; beq = [12; 6]; lb = [0; 0; 0; 0; 0; 0]; [x, fval, exitflag, output, lambda] = ... linprog(f, , , Aeq, beq, lb) x =[0.0000, 136.7656, 130.7656, 0.0000, 12.0000] f = -30 exitflag = 1 output = iterations: 5 cgiterations: 0 algorithm: 'lipsol' Note that x2 = 136.7656 – 130.7656 = 6.0. Two problems converge to the same solution. 2. Solve the linear programming problem using MATLAB. Submit all your input and output data. Maximize f = 2 x1 + 5 x2 − 4.5 x3 + 1.4 x4 Subject to 5 x1 + 3 x2 + 1.5 x3 ≤ 8 −1.8 x1 − 6 x2 + 4 x3 + x4 ≥ 3 −3.6 x1 + 8.2 x2 + 7.5 x3 + 5 x4 = 15 xi ≥ 0, i = 1 to 4 >> f = [-2; -5; 4.5; -1.4]; >> A=[5 3 1.5 0; 1.8 6 -4 -1]; >> Aeq = [-3.6 8.2 7.5 5]; >> b = [8; -3]; >> beq = [15]; >> lb = zeros(4,1); >> [x, fval, exitflag, output] = ... linprog(f,A,b,Aeq,beq,lb,,,optimset('Display','iter')); Residuals: Primal Dual Duality Total Infeas Infeas Gap Rel A*x-b A'*y+z-f x'*z Error --------------------------------------------------Iter 0: 2.03e+03 1.31e+01 2.47e+03 3.90e+02 Iter 1: 2.15e+02 2.43e-15 2.42e+02 1.24e+01 Iter 2: 2.27e+00 5.62e-15 1.30e+01 6.05e-01 Iter 3: 1.96e-14 2.22e-16 6.46e+00 7.15e-01 Iter 4: 4.99e-12 1.09e-15 2.99e-01 6.65e-02 Iter 5: 3.69e-13 3.64e-15 1.52e-02 3.44e-03 Iter 6: 1.69e-14 3.67e-15 7.74e-07 1.75e-07 Iter 7: 1.02e-14 1.68e-15 7.74e-13 1.74e-13 x = [1.4164, 0.0000, 0.6119, 3.1020] fval = -4.4221 Thus, the optimum design is x* = [1.4164, 0.0, 0.6119, 3.1020] and the objective function is f* = 4,4221. All three constraints are active and corresponding Lagrange multipliers are [0.0278, -2.6567, 0.8113]. Note that the λ2 < 0 because the original constraint is greater than or equal to type. ...
View Full Document

Ask a homework question - tutors are online