Sei sulla pagina 1di 13

Abstract

The aim of this particular project was to apply optimization techniques learnt during the
course of the semester. Two problems are selected for that matter. The 1st problem is
regarding the design of cantilever beam for the minimization of cost. In this problem
application of KKT and nonlinear optimization techniques are shown. Whereas second
problem is a manufacturing LP problem for profit maximization. This problem highlights
several ways off solving linear programming problems.

Problem#1

A beam of rectangular cross section is subjected to a maximum bending moment of M and


maximum shear of V. The allowable bending and shearing stresses are a =165 MPa and a
=50 MPa, respectively.

It is also desired that depth of the beam shall not exceed twice its width. Where d is the
depth and b is the width of the beam. The maximum bending moment and Shear are M=140
kN. m, V=24 kN.

The purpose of the task is to formulate the optimum design problem and solve it using
various methods.

Figure1: Cross section of beam

Formulation of Objective function and Constraints

Data and Information collection


M = 140KNm = 1.4 108 N. mm;
V = 24KN = 2.4 104 N;

a = 165MPa = 165N/mm2 ;

Ta= 50MPa = 50N/mm2 ;

Definition of Design Variables


B= width of the beam, mm

D= depth of the beam, mm

Optimization of Cost Function


Optimization criterion is to minimize the cross sectional area and the cost function is
defined as

Area= bd, mm2

Formulation of Constraints
6(1.4107 )
Bending stress constraints: 6M/bd2 a or 165
2

6(1.4 108 )
1 = 165 0
2
3 3(2.4104 )
Shear stress constraints: 2 50
2

3(2.4 104 )
2 = 50 0
2
Constraint: 2 2 0

3= 2 0

Mathematical constraints: ,

Solution using K.K.T Manually


Minimize f= bd

108
1 = 6(1.4 bd2 ) 165 0

104
g2 = 3(2.4 2bd) 50 0
g3 = d 2b 0

g4 = b 0

g5 = d 0

Assume b= x1 and d= x2

Minimize f= x1x2

1 = 6(1.4 108 /1 22 ) 165 0

104
2 = 3(2.4 ) 50 0
21 2

2 21 0 And -x1 , -x2 0

Now we write the Langrange function

108 2
3(2.4 104 )
= x1 x2 + U1 (6 1.4 4
2 1.65 10 + S1 ) + U2 ( 5000 + S22 )
x1 x2 2x1 x2
2
+ U3 (2 21 + 3 )

Applying necessary condition

108 104
= 2 1 (8.4 2 2 ) 2 (3.6 2 ) 23
1 1 2 1 2

108 104
= x1 2U1 (8.4 ) U2 (3.6 ) + U3
2 X1 X23 X1 X22

108
= 8.4 165 + 12
1 1 22

104
= 3.6 50 + 22
2 1 2

= 2 21 + 32
3

= 21 1
1

= 22 2
2

= 23 3
3
Because number of variables are more than the number of equation so switching
conditions have to be applied now.

Switching conditions
There are eight different possible cases enlisted below. One of these cases is going to give
the optimum solution.

Case 1. 1 = 2 = 3 = 0; gives no solution

Case 2. 1 = 2 = 3 = 0; gives no solution

Case 3. 1 = 2 = 3 = 0; gives no solution

Case 4. 1 = 2 = 3 = 0; gives no solution

Case 5. 1 = 2 = 3 = 0; gives no solution

Case 6. = = = ; gives solution at (108.37, 216.74)

Case 7. 1 = 2 = 3 = 0; gives no solution

Case 8. 1 = 2 = 3 = 0; gives no solution

Case 6 Solution
1 = 2 = 3 = 0;

108
2 1 (8.4 ) 23 = 0 . . ()
12 22

108
1 21 (8.4 3 ) + 3 = 0..(b)
1 2

108
8.4 2 165 = 0..(c)
1 2

104
3.6 50 + 22 = 0.(d)
1 2

2 21 = 0.....(e)

From eq.(e) & eq.(c)

2 = 21

8.4 108 = 1651 22


8.4 108
= 1 22
165
5.25 104 = 122

By using

2 = 21

5.25 103 = (1 )(212 )

5.25 103 = 413

1.312 103 = 13

1 = 108.37

As
2 = 21

So (2 = 2 10.837)

2 = 216.74

Using Eq. (d) to check for S2

22 = 48496.0
From eq.(a) & eq.(b)

3 = 328.2

1 = 0.2

Since hessian of cost function and constraints is positive definite so it is a convex problem as
well.

So optimum solution at (108.37, 216.74) is f=23483 mm2

Solution using K.K.T MATLAB


MATLAB has many capabilities for engineering calculations and analyses. It can also be used
to solve a set of nonlinear equations as well. The primary command used for this purpose is
fsolve. This command is part of the MATLAB Optimization Toolbox. When using MATLAB,
it is necessary to first create a separate m-file containing the equations in the form F(x)=0.
First an .m file containing the non-linear equations is created, find the necessary condition.
Then fsolve is used in separate file to solve these equations by calling this file and giving
guess values.
The file defining the equations is prepared as follows:
Matlab code for first .m file
function F = PrProblem2kkt(x)
F = [x(2)-8.4*10^7*x(1)^-2*x(2)^-2*x(3)-3.6*10^4*x(1)^-
2*x(2)^-1*x(4)-2*x(5);
x(1)-2*8.4*10^7*x(1)^-1*x(2)^-3*x(3)-3.6*10^4*x(1)^-
1*x(2)^-2*x(4)+x(5);
8.4*10^7*x(1)^-1*x(2)^-2-1.65*10^4+x(6)^2;
3.6*10^4*x(1)^-1*x(2)^-1-5000+x(7)^2;
x(2)-2*x(1)+x(8)^2;
x(3)*x(6);
x(4)*x(7);
x(5)*x(8)];

Matlab code for 2nd .m file


x0=[1;1;1;1;1;1;1;1];
options=optimset('Display','iter')
x=fsolve(@PrProblem2kkt,x0,options)

Solution using Graphical Method MATLAB

Optimum point is (b=108mm, d=217mm)

1st and 2nd constraint are active


Optimum solution would be f=23500 mm2

MATLAB code
clear all
close all
% Design variables
[x1,x2] = meshgrid(0:1:300,0:1:300);
% Objective function
f = x1.*x2;
% Constraints
g1 = x2 - 2*x1;
g2 = (6*140*1e6./(x1.*x2.^2)) - 165;
g3 = (3*24*1e3./(2*x1.*x2)) - 50;
% plotting
fv = [0:10000:60000,23500];
cs = contour(x1,x2,f,fv); clabel(cs)
hold on
cs1 = contour(x1,x2,g1,[0,2],'r'); clabel(cs1)
cs2 = contour(x1,x2,g2,[0,-3],'k'); clabel(cs2)
cs3 = contour(x1,x2,g3,[0,-3],'g'); clabel(cs3)
title('Problem 1 Project')
text(200,250,'Feasable Region')
text(53,106,'g1')
text(238,150,'g2')
text(50,20,'g3')
xlabel('b (Beam width, mm)')
ylabel('d (Beam depth, mm)')
hold off
Problem#2

Plastic Cup factory LP problem


A local family-owned plastic cup manufacturer wants to optimize their production
mix in order to maximize their profit. They produce personalized beer mugs and
champagne glasses. The profit on a case of beer mugs is $25 while the profit on a
case of champagne glasses is $20. The cups are manufactured with a machine called
a plastic extruder which feeds on plastic resins. Each case of beer mugs requires 20
lbs. of plastic resins to produce while champagne glasses require 12 lbs. per case. The
daily supply of plastic resins is limited to at most 1800 pounds. About 15 cases of
either product can be produced per hour. At the moment the family wants to limit
their work day to 8 hours.

Formulation of Objective function and Constraints

Definition of Design Variables


1 = Number of beer mugs to be produced daily
2 = Number of champagne glasses to be produced daily.

Formulation of profit Function


Our purpose is to maximise the profit by maximising the production to produce
maximum possible output.
= +

Formulation of Constraints
We have two production constraint and two implicit or mathematical constraints.
Resign constraint
1 = 20x1 + 12x2 1800
1 = 20x1 + 12x2 1800 0

Work hours constraint


1 1
2 = x1 + x 8
15 15 2
1 1
2 = x1 + x 80
15 15 2

Implicit or mathematical constraints


3 = 1 0 Or 3 = 1 0
4 = 2 0 Or 4 = 2 0

Solution by simplex Method

Converting it into standard form


Minimize = 251 202

Subject to

201 + 122 + 3 = 1800


1 1
1 + + 4 = 8
15 15 2
Where X3 and X4 are slack variables

Basic X1 X2 X3 X4 b Ratio
variables
X3 20 12 1 0 1800 90
X4 1/15 1/15 0 1 8 120
Cost -25 -20 0 0 f-0
function

Basic X1 X2 X3 X4 b Ratio
variables
X1 1 3/5 1/20 0 90 150
X4 0 2/75 1/300 1 2 75
Cost 0 -5 5/4 0 F+2250
function

Basic X1 X2 X3 X4 b Ratio
variables
X1 1 0 -7/400 22.5 45 150
X2 0 1 9/80 37.5 75 75
Cost 0 0 1.81 187.5 F+2625
function

Value for non-basic variables X1 and X2 is

X1=45, X2=75

Function value is

= 25(45) 20(75) = 2625

= = (2625) = 2625
Solution using Graphical Method MATLAB

Optimum point is (45,75)


= +
= () + ()
= $

MATLAB code
clc
clear all
[x1,x2] = meshgrid(-10:25:150,-10:25:150);
f=25*x1+20*x2;
g1=20*x1+12*x2-1800;
g2=x1+x2-120;
g3=-x1;
g4=-x2;
cla reset
axis auto
xlabel('x1'),ylabel('x2')
title('Problem 2 Project')
hold on
cv1=[0 2];
const1=contour(x1,x2,g1,cv1,'b');
clabel(const1)
text(20,115,'g1')
cv2=[0 1];
const2=contour(x1,x2,g2,cv2,'c');
clabel(const2)
text(80,38,'g2')
cv3=[0 1];
const3=contour(x1,x2,g3,cv3,'p');
clabel(const3)
text(25,-4,'g3')
cv4=[0 .5];
const4=contour(x1,x2,g4,cv4,'r');
clabel(const4)
text(-4,25,'g4')
text(40,40,'Feasable Region')
fv=[0,1200,2250,2625,2400];
fs=contour(x1,x2,f,fv,'k');
clabel(fs)
grid
hold off

Solution using Excel Solver

In order to solve the LP problem in excel solver, the first step is to write the objective
function and constraints in the excel spread sheet. Then we have to use the solver
add in from the excel menu this add in requires to give the reference cell number of
the objective function and constraint after entering the cell numbers of the
constraints and objective function the solvers gives the solution. Screen sot of solver
dialog box is given below.
If you examine the above dialog box all the function and constraints and solving
method is specified in the dialog box.

The solution of this problem according to above dilag box is shown in the figure
below.

Solution using MATLAB LP


First write the matrix of the coefficients of constraints and objective function then
use the linear programming command to solve the question.
Syntax
A = [20 12
1/15 1/15];
b = [1800 8];
f = [-25 -20];
x = linprog(f,A,b)

Solution
A = [20 12
1/15 1/15];
b = [1800 8];
f = [-25 -20];
x = linprog(f,A,b)
Optimization terminated.

x =

45.0000
75.0000

Conclusion
The aim of this project was to represent the practical application of the different
optimization techniques for solution of some real life problems. The projects explains the
non-linear solutions and application of K.K.T in first part. Whereas second part is used to
highlight the LP problem solutions in various ways. As for as from a students point of view
this project is a summary of optimization course which is learnt during the course of the
semester.

Potrebbero piacerti anche