# Q3(b) PSO maximization, supplied parameters [10]

Subject: Intelligent Systems II

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/is2/#tee/papers/paper-2024-reexam/q3b

Canonical: https://deep-learning-study-room.vercel.app/read/is2/tee/papers/paper-2024-reexam--q3b/

Actual historical paper ·100 marks attempted /140 offered · Q1 compulsory + any four of Q2–Q7. Source defects and solution assumptions are explicitly identified.

**Question. Q3(b)** [10 marks · 2024-06-25]

Find the maximum of f (x)=−x²+5x+20 on −6≤x≤4 using PSO. Use four initial positions −5.6,−5.2,−1.1,2.3. Show detailed computations for iteration 1, with c₁=c₂=1, r₁=r₂=.5, w=1 and all initial velocities zero.

### Answer

#### Given

The four x values; zero velocities; w=1, c₁=c₂=1, r₁=r₂=.5; bounded domain[−6,4].

#### To find

One iteration and the best value actually reached.

#### Formula and why it applies



$$
v_i^{new}=wv_i+c_1r_1(pbest_i-x_i)+c_2r_2(gbest-x_i),\quad x_i^{new}=x_i+v_i^{new}
$$



This is maximization: larger f is better. Initialize each pbest to its own initial position, and freeze the old gbest for the whole simultaneous update.

#### Solution

##### Step 1. Find initial fitness and gbest

| Particle | Position | −x² | 5x | f (x) |
| --- | --- | --- | --- | --- |
| 1 | -5.6 | -31.36 | -28.0 | -39.36 |
| 2 | -5.2 | -27.04 | -26.0 | -33.04 |
| 3 | -1.1 | -1.21 | -5.5 | 13.29 |
| 4 | 2.3 | -5.29 | 11.5 | 26.21 |

Initial values [−39.36,−33.04,13.29,26.21]. Maximum 26.21 occurs at x=2.3.

##### Step 2. Compute new velocities

The first two terms are zero: old velocity=0 and pbest−x=0. Thus vnew=.5(2.3−x).

| Particle | Social difference | Velocity | New position |
| --- | --- | --- | --- |
| 1 | 2.3−(-5.6)=7.9 | .5×(7.9)=3.95 | -5.6 + (3.95)=-1.65 |
| 2 | 2.3−(-5.2)=7.5 | .5×(7.5)=3.75 | -5.2 + (3.75)=-1.45 |
| 3 | 2.3−(-1.1)=3.4 | .5×(3.4)=1.7 | -1.1 + (1.7)=0.6 |
| 4 | 2.3−(2.3)=0 | .5×(0)=0 | 2.3 + (0)=2.3 |

##### Step 3. Evaluate the new positions

| New x | −x²+5x+20 | New fitness |
| --- | --- | --- |
| -1.65 | −(-1.65)²+5(-1.65)+20 | 9.0275 |
| -1.4500000000000002 | −(-1.45)²+5(-1.45)+20 | 10.6475 |
| 0.5999999999999999 | −(0.6)²+5(0.6)+20 | 22.64 |
| 2.3 | −(2.3)²+5(2.3)+20 | 26.21 |

All new positions are in [−6,4], so no boundary repair is required.

##### Step 4. Update pbest and gbest

New positions [−1.65,−1.45,.6,2.3] give fitness [9.0275,10.6475,22.64,26.21]. The first three replace their worse personal records; the fourth ties its record. Global best remains 2.3 with 26.21.

As a separate analytical check, f (x)=26.25−(x−2.5)² has true maximum 26.25 at 2.5. PSO has not reached that point after this one iteration.

**Final answer.** After iteration 1: positions[−1.65,−1.45,.6,2.3], gbest=2.3, achieved fitness 26.21.
