Assignment 2 Report
Assignment 2 Report
Problem 1
Minimise
4x1 +5x2 + x3 +4x4 + 2x5 + 11x6 + 2x7
Subject to:
g1: 2x1 + 4x2 +5x3 + 7x4 + x5 + 4x6 + 10x7 ≥110
g2: 4x1 + x2 + 5x3 + 7x4 +3x7 ≤80
g3: 2x1 + 5x2 + 3x3 + 3x4 + x5 +8x6 + x7 ≥40
x1, x2, x3, x4 ∈ {1, 2,3, 4}
x5, x6, x7 ≥0
Exhaustive Enumeration
Exhaustive enumeration is an optimization technique for discrete variables in which all the
possible combinations of the variables are used to find all possible solutions of a
mathematical model and then the solutions are compared to determine the optimum values.
Matlab Code:
In our problem, there are four discrete variables and three continuous variables. So, to find
the optimum values of those 3 variables linprog was used in the matlab code.
First the range of the discrete variables were set. In our problem the range was from 1 to 4
for x1, x2, x3 and x4 variables. Another variable ‘fstar’ was defined as infinity. This variable
was used to compare the value of objective function ‘O’ for every combination. If the value of
‘O’ is less than the fstar value then that fstar retains the value of ‘O’. For every possible
combination, this comparison takes place. Four ‘for loops’ are run for four discrete variables.
And in those for loops linprog is run to determine the possible values of continuous values
satisfying our three given constraints. Every time 7 possible values of variables are used to
calculate the value of objective function ‘O’ and then compared with the stored value in fstar.
If O< fstar then fstar stores that value of objective function and Xstar stores the
corresponding combination of variables’ values. The loop ends when all the combinations
are checked and compared.
The optimum (minimum) solution was found out to be 42.2763 with corresponding values of
variables as:
fstar = inf;
xstar = [0 0 0 0]; Xstar=[0;0;0;0;0;0;0];
for i = 1:length(x1)
for j = 1:length(x2)
for k = 1:length(x3)
for l = 1:length(x4)
if (O < fstar)
fstar = O;
xstar = [x1(i) x2(j) x3(k) x4(l)]; Xstar=X
end
end
end
end
end
Assignment 2 Umair Irfan Khan - 12635761
I have used excel solver to apply the branch and method on this problem. First, I set the
value of x1 as discrete varying it from 1 to 4, checking for the minimum value of objective
function. In the first tree, as shown below, x1=1 gave the minimum value of objective
function. So, for the next tree x1=1 was held constant while the value of x2 was changed
from 1 to 4 to find the minimum solution. Similarly, all the discrete variables were checked.
Since this was a linear programming problem, excel solver was set to simplex LP.
Thus, the optimal (minimum) solution of the objective function was found out to be, using
excel solver, as:
f(x)= 42.246
for
x1= 1
x2= 3
x3= 4
x4= 1
x5= 0
x6= 0.1447
x7= 6.842
Following are the branches of tree created from the solution of excel solver:
Assignment 2 Umair Irfan Khan - 12635761
NODE 1
NODE 2
X1= 1
f(x)= 41.304
NODE 8
X1= 1
x2= 3
f(x)= 42.043
NODE 13
X1= 1
x2= 3
x3= 4
f(x)= 42.043
The solution from both the methods was found out to be same.
Assignment 2 Umair Irfan Khan - 12635761
Problem 2
Mathematical Model
In this problem, the dimensions of an I beam needs to be determined such that the
resulting cross-sectional area is minimum. The dimensions are shown in the figure
above as x1, x2, x3 and x4. So, these dimensions are our decision variables.
Following design parameters are also given:
𝑥1𝑥2
The section modulus is given as S= 𝑥1 (𝑥3𝑥4 + ) cm3
6
1000M
The bending stress in the beam is given as σb = MPa
S
10𝑃
And the axial stress as σp = 𝑀𝑃𝑎
𝐴
The beam must be able to withstand the bending and axial stresses as well as
the buckling stresses. So, the dimensions should be such that satisfy the stress
constraints, which are given as:
σp 2
x1 4 (1+ )
Buckling constraint: x2 − 145 √ σb
σp 2
≤0
1+173( )
σb
Also, we have to select the dimensions from the following available sizes:
Assignment 2 Umair Irfan Khan - 12635761
So, our objective function is to minimize the cross-sectional area of the beam which
is given as:
Subject to:
𝑔1: σb + σp − 200
σp 2
x1 4 (1 + )
𝑔2: − 145 √ σb
x2 σp 2
1 + 173 ( )
σb
𝑥1 ∈ {60, 61,62}
𝑥2 ∈ {0.4, 0.5,0.6}
𝑥3 ∈ {32, 36,40}
𝑥4 ∈ {0.7, 0.8,0.9}
Exhaustive Enumeration
Exhaustive enumeration is a method in which all the possible combinations of discrete
variables are used to calculate the value of objective function, subject to constraints. The
results of these combinations are then compared to find the optimum solution.
Matlab code:
Exhaustive enumeration is applied on this problem using ‘for loops’ in matlab. First the range
of the discrete variable is set. Initially, a variable ‘fstar’ is assigned inf value which will be
compared by the solution of objective function for each combination of discrete variables.
Then for loops for all four discrete variables are run. Each combination of four variables is
then used to determine the value of objective function A, as well as, the value of constraining
equations. The loops have been given the condition that if both the constraints are satisfied
Assignment 2 Umair Irfan Khan - 12635761
and that A is smaller than the value stored in ‘fstar’ variable, then save the value of A as
‘fstar’. This value of ‘fstar’ will then be used to compare with the values of A calculated by the
next combination of discrete variables. These loops run till the solution of all the possible
combinations are compared with value of ‘fstar’. The minimum value of objective function is
saved in ‘fstar’ and its corresponding combination of variables are returned as the optimum
solution. Following is the solution returned by the code:
clear
clc
x1=[54:2:58];
x2=[1.0:0.1:1.2];
x3=[38:2:42];
x4=[0.5:0.1:0.7];
fstar = inf;
xstar = [0 0 0 0];
for i = 1:length(x1)
for j = 1:length(x2)
for k = 1:length(x3)
for l = 1:length(x4)
Thus, the optimal (minimum) solution of the objective function was found out to be, using
excel solver, as:
For dimensions
x1= 58
x2= 1
x3= 40
x4= 0.7
Following are the branches of tree created from the solution of excel solver:
Assignment 2 Umair Irfan Khan - 12635761
NODE 1
NODE 4
x1=58
f(x)=111.314
NODE 5
x1=58
x2= 1
f(x)=111.314
Node 8
Node 9 Node 10
x1= 58
x1=58 x1= 58
x2=1
x2=1 x2= 1
x3= 38
x3= 40 x3= 42
Not feasible
f(x)= 111.25* f(x)= 111.314
Constraints not satisfied
NODE 9
x1=58
x2= 1
x3= 40
f(x)=111.25
Node 11 Node 12
x1= 58 x1=58 Node 13
x2=1 x2=1 x1= 58
x3= 40 x3= 40 x2= 1
x4= 0.5 x4= 0.6 x3= 40
f(x) = 97 f(x)= 104.8 x4= 0.7
Not feasible Not feasible f(x)= 112.6**
Stress constraint not satisfied Stress constraint not satisfied
Although, the combinations of variables in nodes 11 and 12 provide the minimum values of
areas, they do not satisfy the stress constraint, so our optimum solution is node 13.
As shown below for node 11, one of the constraint was not less than zero.
Assignment 2 Umair Irfan Khan - 12635761
The solution from both the methods was found out to be the same.