# Q4(a) PSO, one iteration [10]

Subject: Intelligent Systems II

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/is2/#tee/mocks/paper-reexam-2026/q4a

Canonical: https://deep-learning-study-room.vercel.app/read/is2/tee/mocks/paper-reexam-2026--q4a/

100-mark timed practice using the actual Re-exam 2026 paper. Q1 compulsory; any four of Q2–Q7. Worked solutions are below the questions.

**Question. Maximize 

$$
F(x)=x_1^2-x_1x_2+x_2^2+3x_1+4x_2+5
$$

 using Particle Swarm Optimization. 

$$
X=\begin{bmatrix}3.1472&-4.0246\\4.0579&-2.2150\end{bmatrix},\;V=\begin{bmatrix}0.2194&0.2449\\0.1908&0.2228\end{bmatrix}
$$

. Take 

$$
W=0.9,\;c_1=c_2=1.5,\;r_1=0.5949,\;r_2=0.0855
$$

. Optimize and give the solution after 1 iteration showing the step-by-step process.** [10 marks]

### Answer

#### Given

P1: 

$$
x=(3.1472,\,-4.0246)
$$

, 

$$
v=(0.2194,\,0.2449)
$$

. P2: 

$$
x=(4.0579,\,-2.2150)
$$

, 

$$
v=(0.1908,\,0.2228)
$$

. 

$$
c_1r_1=0.89235
$$

, 

$$
c_2r_2=0.12825
$$

.

#### To find

Updated velocities, positions, pbest and gbest after one iteration.

#### Formula and why it applies



$$
v^{new}=wv+c_1r_1(pbest-x)+c_2r_2(gbest-x),\quad x^{new}=x+v^{new}
$$



Initial personal bests equal the starting positions. Use one frozen global best for all particles. This question maximises fitness, so keep a memory only when its score is larger.

#### Solution

##### Step 1. Fitness of P1 (term by term)



$$
x_1^2=9.904868,\;-x_1x_2=+12.666221,\;x_2^2=16.197405,\;3x_1=9.4416,\;4x_2=-16.0984
$$





$$
F_1=9.904868+12.666221+16.197405+9.4416-16.0984+5=37.1117
$$



##### Step 2. Fitness of P2



$$
F_2=16.466552+8.988249+4.906225+12.1737-8.86+5=38.6747
$$



##### Step 3. pbest and gbest

pbest = current positions. 

$$
38.6747>37.1117
$$

, so **gbest = P2 = (4.0579, −2.2150)**.

##### Step 4. Particle 1 updates



$$
v_{11}=0.9(0.2194)+0+0.12825(4.0579-3.1472)=0.19746+0.116797=0.314257
$$





$$
x_{11}=3.1472+0.314257=3.461457
$$





$$
v_{12}=0.9(0.2449)+0+0.12825(-2.2150+4.0246)=0.22041+0.232081=0.452491
$$





$$
x_{12}=-4.0246+0.452491=-3.572109
$$



##### Step 5. Particle 2 updates (gbest particle: only inertia acts)



$$
v_{21}=0.9(0.1908)=0.17172,\quad x_{21}=4.22962;\qquad v_{22}=0.9(0.2228)=0.20052,\quad x_{22}=-2.01448
$$



##### Step 6. New fitness and bests

Use the same objective at each new position. Keep full precision internally; displayed coordinates are rounded.



$$
F(3.461457275,-3.5721088)=(3.461457275)^2-(3.461457275)(-3.5721088)+(-3.5721088)^2+3(3.461457275)+4(-3.5721088)+5
$$





$$
=11.981686467+12.364701993+12.759961279+10.384371825+(-14.2884352)+5\approx38.202286364
$$





$$
F(4.22962,-2.01448)=(4.22962)^2-(4.22962)(-2.01448)+(-2.01448)^2+3(4.22962)+4(-2.01448)+5
$$





$$
=17.889685344+8.520484898+4.05812967+12.68886+(-8.05792)+5\approx40.099239912
$$



| Particle | New position | New F | Old F | pbest |
| --- | --- | --- | --- | --- |
| 1 | (3.461457, −3.572109) | 38.2023 | 37.1117 | updated |
| 2 | (4.22962, −2.01448) | 40.0992 | 38.6747 | updated |

The best pbest is now P2's with F = 40.0992, so gbest moves to (4.22962, −2.01448).

**Final answer.** 

$$
V=\begin{bmatrix}0.314257&0.452491\\0.17172&0.20052\end{bmatrix}
$$

, 

$$
X=\begin{bmatrix}3.461457&-3.572109\\4.22962&-2.01448\end{bmatrix}
$$

. Both particles improved; new gbest = (4.22962, −2.01448) with F = 40.0992.

**Official key warning.** The re-exam answer key solves a *different* problem: particles (0.4, 0.3) and (0.3, 0.4) with velocities (0.1, −0.2) and (−0.2, 0.1), giving fitness 7.53 and 7.86. Do not copy it. The numbers above solve the question as printed.

This X and V are particles 1 and 2 of your lecture's five-particle example; only the function differs (+3x₁ and +5 here instead of +2x₁ and +3).
