Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Soft computing techniques and applications

Overview of main soft computing techniques (neural nets, fuzzy systems, evolutionary and swarm methods, simulated annealing) and how they are used to solve hard optimization, uncertain and pattern-recognition problems in engineering.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Soft computing techniques give engineers ways to solve problems that are hard for exact ("hard") methods: optimization with many local minima, noisy or incomplete data, and design of controllers and pattern recognisers. You will use these methods in tasks such as parameter tuning, adaptive control, feature extraction, search and optimisation, and building robust classifiers when models are uncertain.

Key ideas

Start from first principles and plain definitions.

  • Soft computing: methods that tolerate imprecision, uncertainty, partial truth and approximation; they trade exactness for robustness and speed. (Contrast with hard computing which seeks exact solutions using precise models.)

  • Optimization problem (standard form): given a vector x in domain D, find x* that minimises an objective function f(x) possibly subject to constraints g_i(x) ≤ 0 and h_j(x) = 0. Here f(x) is the quantity to be minimised (cost) or maximised (fitness if maximisation).

  • Fitness function: a mapping from candidate solution x to a scalar that measures how good x is. In evolutionary algorithms the algorithm tries to maximise fitness.

  • Genetic algorithm (GA): a population-based search inspired by biological evolution. Key parts: chromosome (encoded candidate solution), population (set of chromosomes), selection (choose parents proportional to fitness), crossover (combine parents to create children), mutation (random changes). GA works by iterative selection and variation.

    • Give exact statement used in exams (Holland's Schema Theorem): Let H be a schema (a pattern over bit positions) with order o(H) (number of fixed bits) and defining length δ(H) (distance between first and last fixed bit) in strings of length l. Under proportionate selection, one-point crossover with probability pc, and per-bit mutation probability pm, the expected number m(H, t+1) of individuals matching H in the next generation satisfies:
      • Expected contribution after selection only: E_sel[m(H, t+1)] = m(H, t) · f(H)/f̄ where f(H) is average fitness of strings matching H and f̄ is average fitness of population.
      • A lower bound accounting for crossover and mutation commonly given: m(H, t+1) ≥ m(H, t) · (f(H)/f̄) · [1 - pc · δ(H)/(l-1) - o(H) · pm]. State assumptions: proportional selection, one-point crossover, small pm, and independent effects approximated linearly.
  • Simulated annealing (SA): a single-solution stochastic search that accepts worse solutions with probability exp(-ΔE/T) where ΔE is increase in objective (for minimisation) and T is temperature. SA mimics physical annealing and can escape local minima.

    • Convergence statement used in exams: SA with an appropriate (very slow) cooling schedule (e.g. T_t ∝ 1/log(t)) converges in probability to a global optimum under mild regularity assumptions on the objective. (This needs careful mathematical conditions — see verify.)
  • Particle swarm optimisation (PSO): population of particles; each particle i has position x_i and velocity v_i. Particles are attracted toward their own best position pbest_i and the neighbourhood/global best gbest. Basic discrete-time update per dimension:

    • v_i ← w·v_i + c1·r1·(pbest_i − x_i) + c2·r2·(gbest − x_i)
    • x_i ← x_i + v_i where w is inertia, c1 and c2 are acceleration coefficients, r1,r2 are uniform random numbers in [0,1].
  • Artificial neural networks (ANN): feedforward multilayer perceptron (MLP) with layers of neurons computing a = φ(Wx + b); common activations: sigmoid, tanh, ReLU. Trained by backpropagation using gradient descent: update parameters θ by θ ← θ − η · ∂E/∂θ, where E is loss and η the learning rate. Perceptron (single-layer) uses a hard-threshold activation for linear classification.

  • Fuzzy set: for a universe X, a fuzzy set A is defined by a membership function μ_A: X → [0,1]. μ_A(x) gives the degree to which x belongs to A. Operations:

    • Fuzzy union: μ_{A∪B}(x) = max(μ_A(x), μ_B(x)) (one common t-conorm).
    • Fuzzy intersection: μ_{A∩B}(x) = min(μ_A(x), μ_B(x)) (one common t-norm).
  • Fuzzy inference (Mamdani style): steps are (1) fuzzification: convert crisp inputs to membership values, (2) rule evaluation: apply fuzzy rules (IF antecedent THEN consequent) combining antecedent memberships (commonly using min or product for AND), (3) aggregation: combine outputs of rules per output variable (commonly max), (4) defuzzification: convert fuzzy output to crisp value (common method: centroid/centre of gravity).

  • Hybrid systems: combine two or more soft computing techniques, e.g., neuro-fuzzy (neural network learns membership functions or rules), genetic algorithms optimising neural network weights or fuzzy rules, PSO tuning controller parameters. These hybrids exploit complementary strengths.

Diagrams to draw for exams (describe what to draw and label):

  • For a GA: draw a flowchart with boxes labelled Initialize population, Evaluate fitness, Selection, Crossover, Mutation, Replace/Next generation; show arrows and a loop back to Evaluate.
  • For a fuzzy membership function: draw horizontal axis x (variable, e.g., temperature in °C), vertical axis μ in [0,1], then a triangular membership function with coordinates (a,0),(b,1),(c,0) and label a,b,c and the peak b.
  • For PSO: draw particles as points in 2D search space, arrows showing velocity, indicate pbest and gbest positions.

Formulas

Objective: minimize f(x), x in D — f(x): objective (unit depends on problem), x: decision vector (unit per component). Applies to all optimisation problems.

Expected copies after selection: E_sel[m(H, t+1)] = m(H, t) · f(H) / f̄ — m(H,t): number of strings matching schema H at time t (dimensionless), f(H): average fitness of those strings, f̄: population average fitness.

Schema theorem (lower bound): m(H, t+1) ≥ m(H, t) · (f(H)/f̄) · [1 - pc · δ(H)/(l-1) - o(H) · pm] — pc: crossover probability (dimensionless), δ(H): defining length, l: string length, o(H): order (number of fixed bits), pm: per-bit mutation probability.

SA acceptance probability: p_accept = min(1, exp(-ΔE / T)) — ΔE = E_new − E_current (same units as objective f), T: temperature (same units as f); for minimisation problems accept all improvements (ΔE ≤ 0) with probability 1.

PSO velocity update (per dimension): v ← w·v + c1·r1·(pbest − x) + c2·r2·(gbest − x) — v,x,pbest,gbest have same units as decision variable; w,c1,c2 dimensionless; r1,r2 ∈ [0,1].

Centroid (COG) defuzzification: x* = (∫ x · μ_out(x) dx) / (∫ μ_out(x) dx) — x in domain of output (units of output), μ_out(x) dimensionless. Applies when μ_out(x) integrates to non-zero. For discrete universes, use x* = (Σ x_k μ_out(x_k)) / (Σ μ_out(x_k)).

Worked examples

Example 1 — GA: expected schema copies after selection Problem data: population of 3-bit strings (l = 3) to keep it small. Population (string : fitness):

  1. 100 : 10
  2. 010 : 20
  3. 110 : 30
  4. 111 : 40 Let schema H = '1**' (first bit = 1). m(H, t) = 3 (strings 100,110,111). f(H) = average fitness of these = (10+30+40)/3 = 80/3 ≈ 26.6667. Population average f̄ = (10+20+30+40)/4 = 100/4 = 25. Selection-only expected copies: E_sel[m(H, t+1)] = m(H, t) · f(H)/f̄ = 3 · (80/3) / 25 = 3 · (26.6667 / 25) = 3 · 1.066667 = 3.2000. Final: 3.2 expected copies. (If asked include crossover/mutation lower bound, plug into schema theorem with choices of pc and pm.)

Example 2 — Simulated annealing acceptance probability Given current cost E = 100 (units: arbitrary cost), candidate cost E' = 110, temperature T = 10. ΔE = 110 − 100 = 10. Use p_accept = exp(-ΔE/T) = exp(-10/10) = exp(-1) ≈ 0.367879. Final: acceptance probability ≈ 0.3679.

Example 3 — PSO numeric update (1D) Given: x = 2.0 (position), v = 0.5 (velocity), pbest = 1.0, gbest = 0.0, w = 0.7, c1 = 1.5, c2 = 1.5, r1 = 0.6, r2 = 0.3. Compute v_new = 0.7·0.5 + 1.5·0.6·(1.0 − 2.0) + 1.5·0.3·(0.0 − 2.0) = 0.35 + 0.9·(−1.0) + 0.45·(−2.0) = 0.35 − 0.9 − 0.9 = −1.45. x_new = x + v_new = 2.0 + (−1.45) = 0.55. Final: v_new = −1.45, x_new = 0.55.

Common mistakes

  • Applying the schema theorem without stating its assumptions (proportional selection, one-point crossover approximation, small mutation).
  • In SA, using an aggressive cooling schedule and then claiming guaranteed global convergence — convergence requires very slow cooling (logarithmic), which is often impractical.
  • In fuzzy systems, mixing up membership degree (dimensionless in [0,1]) with probability; they are different concepts.
  • For PSO, forgetting randomness r1,r2 each iteration and treating pbest/gbest differences as constants.

For your exam

Question types you will see:

  • Definitions and short notes (define fuzzy set, GA operators, PSO update rule).
  • Derivations (derive expected copies after selection, give steps to reach the schema theorem bound, derive SA acceptance probability from Boltzmann law intuition).
  • Numericals (compute acceptance probability for SA, update a PSO particle numerically, compute expected schema copies as in Worked Example 1).
  • Diagrams (draw GA flowchart, sketch membership functions and label parameters, sketch PSO particle movement).
  • Short programs (sometimes write pseudocode for GA or SA loops).

What full-marks answers include:

  • Clear definitions with bold naming of terms (e.g., "A fuzzy set is ..."), statement of assumptions, step-by-step derivations, and a labelled diagram when asked.
  • For numericals: list formulas used, show intermediate arithmetic, units where relevant, and final bold answer.
  • For proofs/derivations: state required assumptions explicitly (selection scheme, crossover type, mutation model).

Quick check

  1. What is a membership function?
  2. Write the SA acceptance probability for a minimisation problem.
  3. In PSO, what two best positions guide a particle? Answers: 1) A function μ_A(x) ∈ [0,1] giving degree of membership of x in fuzzy set A. 2) p = exp(−ΔE / T) where ΔE = E_new − E_current. 3) pbest (particle's own best) and gbest (global or neighbourhood best).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?