You are on page 1of 14

UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18

EXAMINATION FOR COURSE EG551T

Qu Solution Page 1 of
No. 1 14
Marks (a) Taylor series expansion about the origin o:
N N
∂f 1 ∂2 f
f ( x )=f ( o ) + ∑ xi + ∑ xi x j +O(δ x 3 )
i=1 ∂ x i 2 i , j=1 ∂ x i ∂ x j
Ignoring terms above x 3 and writing in matrix form, this becomes:
1
f ( x )=c−b . x+ x . H . x
2
Differentiating this therefore gives
∇ f =Hx−b
This therefore means that for a turning point, the gradient of the function will be equal
to zero and so the position of the turning point can be immediately calculated by re-
arranging this equation:
Hx−b=0 x=H −1 b
As long as the Hessian and b vector can be calculated and the inverse is also
4 computationally tractable, then the position of the turning point can therefore be
calculated in one step.

The equation given in the question can be partially differentiated twice to give the
(b) Hessian. Working shown below:

1 1
f ( x , y )= a x 2+ b y 2 +cxy + px +qy +r
2 2

∂f
=ax+ cy+ p
∂x
∂f
=by+ cx +q
∂y
∂2 f ∂2 f ∂2 f
=a , =b , =c
∂ x2 ∂ y2 ∂ x∂ y

Since the Hessian is defined as below we get the result:


∂2 f ∂2 f

6
H=
[
∂ x2
∂2 f
∂x ∂ y
∂ x∂ y

∂y
2
∂ f
2 ][
=a c
c b ]
This allows the Hessian to be created directly from the definition of the equation as
long as a, b and c can be found.
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu Solution Page 2 of
No. 1 14
Marks (c) As a symmetric matrix, H above has two mutually orthogonal normalised eigenvectors
v1 and v 2 (with corresponding eigenvalues λ 1 and λ 2) such that v1 . v 1=1 and that
v1 . v 2=0 .
To diagonalise H, construct matrix O
vT
[ ][ v
Oij = 1T = 11 12
v2
v
]
v 21 v 22
Using the above definitions we can see that
v .v v .v 1 0
T
[
OO = 1 1 1 2 =
v1 . v2 v2 . v2 ][ ]
0 1
We can now diagonalise H to obtain the matrix D as follows
vT vT
[]v2 []
v2 [ λ v .v λ v .v
D=OH O T = 1T H [ v 1 v 2 ] = 1T [ λ 1 v 1 λ2 v 2 ]= 1 1 1 2 1 2 = 1
λ v
1 1 . v 2 λ v
2 2
][ ]
. v 2
λ 0
0 λ2
, clearly D

contains the eigenvalues of H


8 Further, we can introduce a rotated position vector u=Ox so that manipulating the
Hessian term from part (a)
1 T 1 1 1
x Hx= x T O T OH O T Ox= u T Du= ( λ1 u21 + λ2 u22 )
2 2 2 2
Clearly this expression is positive for any nonzero u values and if the eigenvalues are
both positive

(d)
Taylor series expansion about the origin o:
6 N
∂f 1
N
∂2 f
f ( x )=f ( o ) + ∑ xi + ∑ xi x j +O(δ x 3 )
i=1 ∂ x i 2 i , j=1 ∂ x i ∂ x j
Ignoring terms at and above x 3 and writing in matrix form, this becomes:
1
f ( x )=c−b . x+ x . H . x
2
Differentiating this therefore gives
∇ f =Hx−b
Along any direction, the variation in gradient is given by
δ ( ∇ f )=Hδx
Suppose that f has been line minimised in direction u at point p:
u . ∇ f =0
Then a successive line minimisation along another direction v without spoiling the
previous line minimisation should satisfy:
u . δ ( ∇ f )=0
Where the variation of the gradient is induced by moving along v hence δ ( ∇ f )=H . v
If therefore follows that we have
u . H . v =0
as required.

The directions u and v thus defined are said to be conjugate to each other.

Qu 2 Solution Page 2 of
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

No. 14
Marks Firstly formulate the problem in terms of Lagrangian multipliers
F ( d , a , λ )=8 d 2−2 a+ λ( d 2+ a2−1)
Construct partial differential equations
∂F ∂F ∂F
=16 d +2 λd=0 =−2+2 λa=0 =d 2 +a 2−1=0
∂d ∂a ∂λ
Factorise 1st equation to give
d ( 16+2 λ )=0 yields→
d=0∨λ=−8
If d=0 then from constraint
( 0 )2 +a 2−1=0 yields a=± 1

And so points of (0,-1) and (0,1). If λ=−8 then from 2nd partial derivative above
−2−16 a=0 yields a=−1/8

Putting this into constraint
−1 2 1 63
d2+( )8
−1=0 yields d2 =1−

yields x=±
64 → 64 √
This gives a further two points of −( √ 6364 ,− 18 ) and (√ 6364 ,− 18 )
This is a total of four points, which have function values of 2, -2, 8.125 and 8.125.
Therefore the minimum is at (0,1), with maximum at last two points generated above.

10
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu Solution Page 4 of
No. 3 14
Marks (a) With reference to the figure below, a triplet of points a < b < c is chosen
along the x-axis to “bracket” the minimum, the requirement for which is
f(b) < f(a) and f(b)  < f(c). A fourth point x = d is chosen within the interval
a,c. There are now two possible cases to consider. In case 1 (as shown)
f(d) > f(b) and the triplet a,b,d brackets the minimum. In case 2 f(d)  < f(b)
and the triplet b,d,c brackets the minimum.

f(x)
case 1: f(d) > f(b)

new triplet is a,b,d

f(d)
f(b)

a b d c x

The new bracketing triplet is chosen, so that in case 1 the interval d,c is
discarded, or in case 2 the interval a,b is discarded. (For the optimal golden
section choice of position, either of the new triplets has overall length 0.618
of the original triplet.) This process is continued until a sufficiently short
triplet is reached.
8
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu Solution Page 5 of
No. 3 14
Marks ( b) The definition of the new data points is given by:
c=a+r(b-a) (1)
d=b-r(b-a) (2)
For 0<r<1/2 we see from the first equation above that a<c<(a+b)/2 and from the
second equation above that (a+b)/2<d<b. Combining these together we get the
desired order a<c<d<b.

Refer to the diagram below (diagram not required for full marks). If f(c)<f(d) then the
function f(x) can only increase from x=d to x=b or f(x) is not unimodal. It follows that
no minimum can be found in [d,b] and therefore [a,d] should be adopted as the new
interval for further search.

From the description e-a=d-c=r(d-a) we have


e=a+r(d-a) (3)
c=d-r(d-a) (4)

Subtracting eqs (1) and (2) we get


d-c=(1-2r)(b-a) (5)
Re-arranging (4) gives and substituting in eq (2)
d-c=r(d-a)=r(1-r)(b-a) (6)
Equating the right hand sides of eq (5) and (6) we obtain the equation for r as
2
r −3 r +1=0
This equation has two roots:
3−√5 3+ √ 5
r= =0. 382 r= =2 .618
2 and 2
8 3−√5
r= =0. 382
However only the first root 2 is used for golden section search as it
satisfies 0<r<1/2.
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu Solution Page 6 of
No. 3 14
Marks This would reduce the interval to 0.5 of its previous length at each iteration, rather than
(c) to the “golden” ratio 0.618. However, it is necessary to check which half of the
original interval contains the minimum. A “natural” procedure is to select new points,
again bisecting each half-interval (see figure below).
f(d) > f(b), so that a,d,b does not
f(x) “bracket minimum, even though
minimum lies in interval a,b

bc
e
2
ab
d
2

a c x
ac
b
2
As in this example, neither a,d,b nor b,e,c is guaranteed to bracket the minimum. Thus,
the original proposal is not a good idea. However, d,b,e does bracket, and is also of
6 length 0.5. Thus the method can be used, at the cost of a three-way rather than two-way
decision at each stage. As each decision requires one “wasted” computation of f(x), the
final balance of computational cost is not clear-cut.
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu 3 Solution Page 7 of
No. 14
Marks Number of
iterations Start modified Initial values
(d) and error bisection search for a and b
level

Calculate mid point c,


plus 2 further midpoints
d and e between ac and
cb such that a<d<c<e<b

Calculate
corresponding
function values f(a),
f(b), f(c), f(d), f(e)

Yes Is f(d)<f(c) No Is f(c) <f(e)


No

Yes

Triplet is adc. Move Triplet is dce. Move Triplet is ceb. Move


b=c, c=d, f(b)=f(c), a=d, b=e, f(a)=f(d), a=c, c=e, f(a)=f(c),
f(c)=f(d) f(b)=f(e) f(c)=f(e)

No

calc new d and e


and f(d) and f(e)

b-a<error

5
No

Maximum
iterations?
Yes

Yes

Return a and b

Qu 3 Solution Page 7 of
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

No. 14
Marks User input of number of iterations, size of error, and initial values of a and b
(d) Check that a<b otherwise return error value to user
Calculate mid point c=(a+b)/2
Calculate two further midpoints of d=(a+c)/2 and e=(c+b)/2
Calculate function values for all points a, b, c, d, e
While number of iterations less than that defined by user and (a-b)> error tolerance:
If f(d)<f(c)
Triplet is adc and so set b=c, c=d, f(b)=f(c), f(c)=f(d)
Else if f(c)<f(e)
Triplet is dce and so set a=d, b=e, f(a)=f(d), f(b)=f(e)
Otherwise f(e)<f(c) and f(e)<(d)
Triplet is ceb and so set a=c, c=e, f(a)=f(c), f(c)=f(e)
End of if statements
Calculate new d and e using same equations defined above
5 Calculate new function values for f(d) and f(e)
Increase increment count
End of while loop
Return a and b
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu 4 Solution Page 9 of
No. 14
Marks
2 2 2
Examine the turning points of f ( x́ )=( x1−2a ) + ( x 2−2 b ) + ( x 3−2 c )

2( x1 −2 a)

( )
∇ f ( x́ )= 2( x 2−2 b) =0 when x 1=2 a, x 2=2 b, x 3=2 c
2( x 3−2 c)
Now for second order derivative
2 0 0
( )
(
H x́ = 0 2 0
0 0 2 )
Now want to calculate eigenvalues of this:
2− λ 0 0
det H −λI =0=det 0
( )
( 0
2−λ
0 2−λ ) 3
0 = ( 2−λ ) =0

6 Therefore the eigenvalue(s) are solved by 2− λ=0 and this results in λ=2, which is
manifestly positive, and therefore the turning points are at a minimum of the function
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu Solution Page 10
No. 5 of 14
Marks The figure below shows an example of the Pareto front, which gives a set of solutions
where no objective can be improved without sacrificing at least one other objective.
There may be a single (or multiple) set of solutions however that are equally as good or
better than all other solutions with respect to all objectives. This is indicated by the red
line which shows the set of optimal solutions. Lighter green solutions are suboptimal
and the yellow solution marked “infeasible” is a solution that is not possible under the
constraints given.

For many real world Engineering problems, there is not a single optimisation goal but a
number of goals that are to be achieved. For example, building a bridge (such as new
Forth Road bridge), will have an associated cost and also weight and strength
components, all of which are to be optimised concurrently.

6
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu Solution Page 11
No. 6 of 14
Marks (a) A solution for genetic algorithms that can be integrated into the usual genetic algorithm
operators such as crossover and mutation uses a binary chromosome string, and in this
case there are seven defined elements that can take any one of the sequential positions
from 1 to 7. A solution therefore is made up of seven numbers indicating the order of
the elements. A binary number up to 7 is defined by a 3 digit binary number with 111
equal to 7. We need 7 of these to represent each element in turn.
Therefore the chromosome can look like this:
Element 1 Element 2 Element 3 Element 4 Element 5 Element 6 Element 7
XXX XXX XXX XXX XXX XXX XXX
Giving a chromosome that is 21 binary characters in length in total. Each 3 digit binary
will therefore identify the position of the element.
It is also possible to represent a solution by defining the chromosome in the following
manner:
Position 1 Position 2 Position 3 Position 4 Position 5 Position 6 Position 7
XXX XXX XXX XXX XXX XXX XXX
Again this will give a chromosome that is 21 binary characters in length in total. Each
6 3 digit binary will in this case identify the element at the particular position.

The issue when creating a solution is that either all elements are present only once in
the chromosome or that each position is present only once in the chromosome,
depending on which of the two methods above is adopted.
(b)
To calculate an overall fitness for each individual will require two values to be
calculated, the change in flow and the change in energy for the particular solution.
The table can be used to define what the rules should be used for any solution.
In pseudocode this becomes:
For each chromosome
Extract the element and order of element
Give initial flow rate of 100 and energy of 100
If a compressor is followed by a pump, increase flow by
5%, increase energy by 10%
If a filter is followed Pump, increase flow rate by 5% and
decrease energy by 5%
If a separation unit is followed by a compressor, decrease
flow rate by 5% and increase energy by 10%
If a compressor is followed by a heat exchanger, decrease
flow by 10% and increase energy by 10%
If a distillation tower is followed by a pump, decrease
flow rate by 5% and decrease energy by 5%
If a distillation tower is followed by a storage tank,
increase flow rate by 10% and decrease energy by 10%
Return final flow rate and energy usage

Note that the question does not give information about how the flow rate and energy
4 usage should be combined, and therefore an approach such as that described in the
answer to Question 5 should be implemented. Alternatively, the answer could look to
combine these two together in some manner – however noting that a smaller energy
value is better and a higher flow rate is better which will need to be reflected in the
calculation in some way.
Qu Solution Page 11
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

No. 6 of 14
Marks The roulette wheel selection method relates its probability of being selected for
(c) breeding to its fitness, when compared to other individuals in the population. This can
be described mathematically as:
fi
pi = N
∑ j=1 f j , where pi is the probability for individual i, N is the number of
f
individuals in the population, and i is the fitness for individual i.
An example illustration for 6 individuals and their associated fitness is shown in the
figure below. In this case, a random number is generated between 0 and F, which is
defined as the total fitness of all individuals.

4
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu Solution Page 13
No. 7 of 14
Marks
Number of Start Intelligent Number of
iterations water drops water drops

Number of
water drops at
maximum?

No

Generate a water
drop at random Yes
point

Move each water


drop based on
underlying function

4
No Have drops
accumulated?

Yes

Randomly assign
No drops to different
local positions

Return best water


Max iteration? Yes
drop
UNIVERSITY OF ABERDEEN SCHOOL OF ENGINEERING SESSION 2017-18
EXAMINATION FOR COURSE EG551T

Qu Solution Page 14
No. 7 of 14
Marks Ask user to input number of iterations and number of water drops to use
While number of iterations is less than maximum
If number of water drops is not at maximum then add new water drop at random
point
For each water drop, move the water drop based on function values around the
water drop point – move the drop “downwards” in the function towards the
4 minimum
If more than one water drop has reached the same point, then have one of the
water drops rise in value until a new downward slope is found
End of while loop
Return function value and position of best water drop

You might also like