Computational Intelligence and OptimizationIntroductionIntelligent control systems often require decisions that cannot be obtained easily from a closed-form control law. A nonlinear plant may contain unknown parameters, discontinuities, actuator limits, delays, disturbances, or multiple competing performance requirements. In such situations, controller design can be formulated as an optimization problem: select controller parameters that minimize a performance index while satisfying safety, physical, and operational constraints. Computational intelligence provides methods for solving difficult optimization problems using adaptation, population search, probabilistic reasoning, or approximate models. This chapter examines gradient-based optimization, genetic algorithms (GAs), particle swarm optimization (PSO), and related metaheuristics. The emphasis is not only on how these algorithms work, but also on when they should be used, how their performance should be compared, and how they can be integrated into a mechatronic control workflow. Learning ObjectivesBy the end of this chapter, the reader should be able to: - Formulate controller tuning as a constrained optimization problem.
- Construct meaningful objective functions for tracking, effort, robustness, and constraint violations.
- Explain gradient-based optimization and its assumptions.
- Describe the operation of genetic algorithms, particle swarm optimization, differential evolution, simulated annealing, and Bayesian optimization.
- Compare methods using convergence, computational cost, constraint handling, repeatability, and solution quality.
- Select and implement an appropriate optimization method for a practical intelligent-control application.
1. Controller Design as OptimizationConsider a dynamic plant represented in discrete time by xk+1 = f(xk,uk,wk), yk = h(xk) where xk is the state vector, uk is the control input, wk represents disturbances or model uncertainty, and yk is the measured output. A controller with parameter vector θ produces uk = κ(yk,rk;θ) where rk is the reference and κ is the controller structure. For a proportional-integral-derivative controller, for example, θ = [Kp,Ki,Kd]T. For a neural or fuzzy controller, θ may contain many weights, scaling factors, or membership-function parameters. The general design problem is minimizeθ J(θ) subject to gi(θ) ≤ 0, i = 1,…,m hj(θ) = 0, j = 1,…,p θL ≤ θ ≤ θU Here, J is the objective function, gi are inequality constraints, hj are equality constraints, and θL,θU are parameter bounds. The formulation is valid for simulation-based or experimentally evaluated controllers, although experimental optimization requires additional safeguards. A common tracking objective is the integral of squared error (ISE): Je = ∫0T e2(t) dt, e(t)=r(t)-y(t) The error has units of the controlled variable, so Je has units of variable-squared multiplied by time. Alternative measures include integral absolute error (IAE), JIAE = ∫0T |e(t)|dt and integral time-weighted absolute error (ITAE), JITAE = ∫0T t|e(t)|dt. ISE strongly penalizes large transient errors; IAE treats errors linearly; ITAE penalizes errors that persist late in the response. The choice should reflect the engineering objective rather than algorithmic convenience. Control effort can be included through Ju = ∫0T u2(t)dt or, when actuator movement is important, JΔu = ∫0T [du(t)/dt]2dt. A multi-objective weighted cost may therefore be written as J(θ)=we\frac{Je}{Je,ref}+wu\frac{Ju}{Ju,ref}+w_Δ\frac{JΔu}{JΔu,ref}+ws\frac{Js}{Js,ref}. The quantities J*,ref normalize terms with different units or magnitudes, and the nonnegative weights we,wu,w_Δ,ws express priorities. Without normalization, one term may dominate merely because of its numerical scale. Safety requirements should not be hidden inside an informal penalty. Examples include actuator saturation, maximum temperature, overshoot, settling time, collision avoidance, and stability. A soft penalty can be written as Jpen=J+ρ\sumi \max(0,gi(θ))2, where ρ is a penalty coefficient. Penalties are simple but may permit unacceptable solutions if ρ is too small. Explicit feasibility rules, repair procedures, or constrained optimizers are preferable when violations are dangerous. 2. Gradient-Based OptimizationGradient methods use local sensitivity information. If J(θ) is differentiable, the gradient is ∇J(θ)=\left[\frac{∂J}{∂θ1},…,\frac{∂J}{∂θn}\right]T. The basic steepest-descent update is θk+1=θk-αk∇J(θk), where αk>0 is the step size. The negative gradient is the local direction of greatest decrease. A fixed step may converge slowly or become unstable; line search or adaptive step-size rules are commonly used. For a twice-differentiable objective, Newton's method uses the Hessian matrix H(θ)=∇2J(θ): θk+1=θk-H-1(θk)∇J(θk). This expression assumes that the Hessian is nonsingular and that the local quadratic approximation is useful. Newton methods can converge rapidly near a well-behaved optimum, but computing and inverting the Hessian is expensive. Quasi-Newton methods, such as BFGS and L-BFGS, estimate curvature without forming the exact Hessian. For a differentiable objective with bound constraints, projected gradient descent is θk+1=Π[θL,θU][θk-αk∇J(θk)], where Π projects each component back into its permitted interval. General nonlinear constraints require methods such as sequential quadratic programming, interior-point methods, or augmented Lagrangian methods. Strengths and limitationsGradient methods are computationally efficient when the model is smooth and gradients are available. They are suitable for online adaptation, high-dimensional parameter vectors, and repeated tuning. Automatic differentiation and adjoint sensitivity calculations can make gradient evaluation practical for complex simulations. However, they may fail or perform poorly when the objective is discontinuous, noisy, multimodal, nonsmooth, or generated by a simulation containing saturation, switching, contact, or logical decisions. They are local methods: the final solution depends on initialization and may be only a local minimum. Finite-difference gradients can also be unreliable when simulation noise is comparable to the change caused by a parameter perturbation. 3. Genetic AlgorithmsA genetic algorithm represents each candidate controller by a chromosome. A population of chromosomes is evaluated using the objective function. The usual cycle is: - Initialize a diverse population within the design bounds.
- Simulate or test each candidate and calculate fitness.
- Select relatively successful candidates as parents.
- Recombine parent chromosomes through crossover.
- Mutate some genes to restore diversity.
- Preserve elite candidates if desired.
- Repeat until a stopping condition is reached.
For minimization, fitness can be assigned from cost using a transformation such as Fi=1/(1+Ji) when Ji≥0. Ranking selection is often safer than direct fitness scaling because it reduces sensitivity to extreme cost values. Real-valued encoding is generally preferable for controller gains. A simple arithmetic crossover for two parent vectors is c1=λp1+(1-λ)p2,\quad c2=(1-λ)p1+λp2, where 0≤λ≤1. Mutation may add a bounded random perturbation to selected parameters. Crossover promotes combinations of useful parameter values, whereas mutation explores new regions. Constraint handling may use rejection, repair, feasibility-first selection, or penalties. A feasibility-first rule ranks feasible solutions ahead of infeasible ones; among feasible candidates it selects the lower cost, and among infeasible candidates it selects the smaller total violation. This is often more reliable than guessing a penalty coefficient. GAs are attractive for nonconvex, discontinuous, and multimodal controller-design problems. They do not require derivatives and can search several regions simultaneously. Their disadvantages include many objective evaluations, stochastic variability, sensitivity to population size and mutation/crossover settings, and possible premature convergence. A GA should therefore be evaluated over several independent runs, not only one lucky run. 4. Particle Swarm OptimizationIn PSO, each particle is a candidate parameter vector. Particle i has position xi and velocity vi. It remembers its personal best position pi and receives information from a neighborhood or the entire swarm through g. The standard global-best update is vik+1=ωvik+c1r1(pik-xik)+c2r2(gk-xik) xik+1=xik+vik+1. Here, ω is the inertia coefficient, c1 and c2 are cognitive and social coefficients, and r1,r2 are independent random numbers uniformly distributed between 0 and 1. Velocity or position bounds are commonly imposed to prevent unrealistic parameter excursions. The cognitive term encourages return toward the particle's own successful experience; the social term attracts it toward the swarm's best-known solution. Large exploration early in the search can be encouraged by a higher inertia coefficient, followed by a gradual reduction. Parameter settings must nevertheless be validated experimentally because convergence behavior depends on scaling, dimension, constraints, and objective geometry. PSO is simple to implement and often reaches good solutions quickly for continuous controller parameters. It has no crossover or explicit chromosome representation. Its main weaknesses are premature swarm clustering, sensitivity to scaling and hyperparameters, and potentially poor handling of narrow feasible regions. A feasibility-preserving position update or repair mechanism is essential for safety-critical control design. 5. Other MetaheuristicsDifferential evolution (DE) creates trial vectors from differences between randomly selected population members. A representative mutation is vi=xr1+F(xr2-xr3), where indices are distinct and F is a scale factor. Binomial crossover combines vi with the current vector, and selection retains the lower-cost candidate. DE is particularly effective for continuous, bounded parameters and is often competitive with PSO. Simulated annealing (SA) accepts an inferior candidate with probability P(accept)=\exp[-(Jnew-Jold)/T], when Jnew>Jold, where T is a temperature parameter that is gradually reduced. Early uphill moves help escape local minima; later cooling promotes refinement. SA uses little memory but may be slow. Bayesian optimization builds a probabilistic surrogate of an expensive objective, commonly using a Gaussian process, and selects the next candidate using an acquisition function such as expected improvement. It is useful when each simulation or physical experiment is costly and the number of controller parameters is modest. It is less suitable for very high-dimensional problems or rapidly changing noisy objectives. Hybrid methods combine global and local search. For example, a GA or PSO can locate promising regions, after which BFGS or sequential quadratic programming performs local refinement. This often gives better solution quality than either method alone, but adds implementation complexity. 6. Comparing Optimization MethodsNo method is universally best. Comparison should use the same plant model, reference trajectories, constraints, stopping budget, hardware assumptions, and objective function. Important criteria are: | Criterion | Gradient methods | GA | PSO | DE/SA/Bayesian methods |
|---|
| Derivatives | Usually required or estimated | Not required | Not required | Usually not required | | Search character | Local | Global and stochastic | Global and stochastic | Depends on method | | Evaluation cost | Low per iteration | High per generation | High per iteration | Varies; Bayesian can reduce evaluations | | Nonsmooth objectives | Weak | Stronger | Stronger | Often stronger | | Constraint handling | Mature constrained solvers | Penalty, repair, feasibility rules | Repair or penalties | Method-dependent | | Repeatability | Usually high | Requires multiple runs | Requires multiple runs | Often stochastic | | High dimension | Often favorable | Can become expensive | Can become expensive | Method-dependent | | Local refinement | Strong | Usually weak without hybridization | Moderate | SA is weak; hybrid methods strong |
Convergence should not mean only the lowest final cost. Report best-so-far cost versus objective evaluations, feasibility rate, median and spread over repeated runs, computation time, and closed-loop performance on unseen disturbances. A statistically lower simulation cost is not meaningful if the controller violates actuator limits or becomes unstable under model uncertainty. A practical stopping rule may combine a maximum evaluation budget with a tolerance criterion: |Jbestk-Jbestk-q|<εJ for q iterations, provided the candidate remains feasible. The tolerance εJ must be selected relative to the scale of the objective. 7. Worked Example: Tuning a PID ControllerConsider a position-control system whose PID controller is u(t)=Kpe(t)+Ki∫0t e(τ)dτ+Kd\frac{de(t)}{dt}. The gains are constrained by 0≤Kp≤20, 0≤Ki≤10, and 0≤Kd≤5. The design objective is evaluated over a 10-second simulation: J=\frac{JIAE}{JIAE,ref}+0.05\frac{Ju}{Ju,ref}+10P, where P is a normalized violation measure. A candidate is rejected if the closed-loop simulation becomes unstable. A suitable procedure is: - Generate an initial population of bounded gain vectors.
- Simulate a unit-step response and one disturbance-rejection test.
- Calculate tracking error, control effort, overshoot, and constraint violations.
- Use PSO or DE to explore the gain space.
- Apply a local constrained optimizer to the best feasible candidate if the simulation is sufficiently smooth.
- Validate the final gains using reference signals and plant parameters not used during optimization.
Suppose a candidate produces JIAE=2.4, Ju=18, with reference scales JIAE,ref=3.0 and Ju,ref=20. If it is feasible, then J=\frac{2.4}{3.0}+0.05\frac{18}{20}=0.8+0.045=0.845. The numerical objective is dimensionless because each physical integral has been divided by a reference value. A different candidate with lower tracking error but excessive actuator effort may have a larger total cost or may be infeasible. This illustrates why controller quality cannot be judged from rise time alone. 8. Applied Case: Illustrative Robotic Joint TuningBackground. An educational four-axis robot uses brushless motors and encoders. Its joints must follow trajectories smoothly while limiting motor current. Problem. Initial PID gains give acceptable tracking at low speed but produce overshoot and current peaks during rapid movement. The plant model includes friction, motor saturation, sensor quantization, and a one-sample computational delay. Analysis. Direct gradient tuning is unreliable because saturation and quantization make the simulated objective nonsmooth. A bounded PSO is selected for global exploration. The cost combines normalized RMS tracking error, RMS current, and a severe penalty for violating current and position limits. Several trajectories and payload values are evaluated so that the optimizer does not overfit one motion. Approach. Each particle contains the PID gains for all joints. Infeasible particles are repaired to gain bounds, and candidates causing unsafe simulated current are ranked below feasible candidates. After PSO convergence, a local search refines the best feasible gains. The resulting controller is tested in simulation with parameter uncertainty, then on the actual robot at reduced speed. Emergency limits remain active independently of the optimizer. Outcome. The optimized controller reduces tracking error and current peaks relative to the initial tuning, but the improvement is smaller on an untrained payload. This reveals the importance of robustness validation rather than relying on the optimization data alone. Learning points. The case demonstrates that the objective function determines what “optimal” means; constraints must be enforced explicitly; stochastic algorithms require repeated runs; and a simulation optimum is not automatically a safe physical controller. 9. Implementation, Robustness, and GovernanceA reliable workflow separates optimization, verification, and deployment. The plant model should be checked against measured data, and simulation time steps should resolve the fastest relevant dynamics. Random seeds, software versions, parameter bounds, and stopping criteria should be recorded for reproducibility. Validation should include disturbances, sensor noise, parameter variations, actuator saturation, communication delays, reference changes, and startup conditions. Stability should be assessed using appropriate analysis or extensive bounded testing; a low finite-horizon cost alone does not prove stability. For safety-critical systems, optimization must never bypass independent interlocks, watchdogs, current limits, or human approval. Computational intelligence also creates governance issues. An optimizer may exploit an unrealistic model, select unsafe transients, or hide design trade-offs inside penalty weights. Engineers must document the objective, constraints, training scenarios, validation scenarios, and known failure modes. In physical experimentation, use low-energy tests, supervisory control, emergency stopping, and staged increases in operating range. Contemporary practice increasingly combines differentiable models with automatic differentiation, surrogate models for expensive simulations, parallel evaluation on GPUs or clusters, and hybrid global-local optimization. These tools improve efficiency but do not eliminate the need for model validation, physical reasoning, or engineering judgment. Chapter SummaryController design can be expressed as constrained optimization over controller parameters. Objective functions may combine tracking error, control effort, actuator movement, robustness, and safety penalties, but terms must be normalized and physically justified. Gradient methods are efficient for smooth differentiable problems and local refinement, whereas genetic algorithms, PSO, DE, and SA are useful when objectives are nonconvex, discontinuous, noisy, or multimodal. Bayesian optimization is valuable when evaluations are expensive and the parameter dimension is limited. Algorithm selection should consider derivative availability, dimensionality, constraint structure, evaluation cost, repeatability, and the risk of local or premature convergence. Fair comparisons require equal evaluation budgets, repeated stochastic runs, feasibility reporting, and validation under unseen conditions. In professional mechatronics practice, optimization is only one stage of controller design; safety verification, robustness analysis, hardware testing, and documentation remain essential. Key TermsOptimization problem: Selection of decision variables to minimize or maximize an objective subject to constraints. Objective function: Quantitative measure of controller performance. Decision vector: The adjustable controller parameters, denoted by θ. Constraint: A condition limiting parameters, states, inputs, or outputs. ISE: Integral of squared tracking error. IAE: Integral of absolute tracking error. ITAE: Integral time-weighted absolute error. Gradient: Vector of first partial derivatives of an objective. Hessian: Matrix of second partial derivatives. Projected gradient: Gradient update followed by projection into a feasible set. Metaheuristic: General search strategy that guides heuristic exploration and exploitation. Genetic algorithm: Population-based method using selection, crossover, and mutation. Chromosome: Representation of one candidate solution in a genetic algorithm. Particle swarm optimization: Population method based on particle memory and social information. Inertia coefficient: PSO parameter controlling persistence of particle velocity. Differential evolution: Population method using scaled differences between candidate vectors. Simulated annealing: Stochastic local-search method that can accept uphill moves. Penalty function: Additional cost assigned to constraint violations. Feasibility: Satisfaction of all required constraints. Robustness: Ability to maintain acceptable performance under uncertainty and disturbances. Review QuestionsShort Answer Questions- What is the role of the objective function in controller optimization?
- Distinguish ISE, IAE, and ITAE.
- Why can gradient methods struggle with actuator saturation?
- What are the cognitive and social terms in PSO?
- Why should stochastic optimizers be run more than once?
Long Answer Questions- Explain how a PID tuning problem can be formulated as a constrained optimization problem.
- Compare genetic algorithms and particle swarm optimization in terms of representation, search behavior, and constraint handling.
- Derive the steepest-descent update and discuss the effect of step size.
- Explain why objective normalization is important in a multi-objective controller cost.
- Describe a complete workflow for safely deploying an optimized controller on a physical mechatronic system.
Analytical / Application Questions- Design an objective function for a motor-position controller where tracking accuracy, current consumption, and overshoot are all important. Justify the terms and constraints.
- A PSO solution has the lowest nominal simulation cost but violates current limits under a changed payload. Analyze why this occurred and propose a revised optimization and validation strategy.
- Select between a gradient method, GA, PSO, and Bayesian optimization for a controller with six parameters when each hardware experiment takes 20 minutes. Justify your choice using evaluation cost, smoothness, constraints, and risk.
Multiple Choice Questions with AnswersQuestion 1Which expression represents a basic steepest-descent update? A. θk+1=θk+αk∇J(θk) B. θk+1=θk-αk∇J(θk) C. θk+1=αk∇J(θk) D. θk+1=θk∇J(θk) Correct Answer: B. θk+1=θk-αk∇J(θk) Question 2Which objective measure gives increasing emphasis to errors that persist later in a response? A. ISE B. IAE C. ITAE D. RMS control effort Correct Answer: C. ITAE Question 3In PSO, the cognitive term attracts a particle toward its: A. Worst population position B. Personal best position C. Initial random position only D. Maximum allowed velocity Correct Answer: B. Personal best position Question 4What is a major advantage of genetic algorithms for controller tuning? A. They always guarantee the global optimum B. They require an exact analytical gradient C. They can handle nonconvex and nonsmooth objectives D. They use no objective-function evaluations Correct Answer: C. They can handle nonconvex and nonsmooth objectives Question 5Why are objective terms commonly normalized in a weighted controller cost? A. To remove all constraints B. To make terms with different scales more comparable C. To guarantee closed-loop stability D. To convert every controller into a linear controller Correct Answer: B. To make terms with different scales more comparable Question 6For the penalty formula Jpen=J+ρ\sumi\max(0,gi)2, what happens when a constraint is satisfied with gi≤0? A. Its penalty contribution is zero B. Its penalty contribution is always one C. Its penalty contribution is negative D. The complete objective becomes undefined Correct Answer: A. Its penalty contribution is zero Question 7Which method is especially appropriate when each objective evaluation is very expensive and the number of parameters is modest? A. Bayesian optimization B. Random guessing without a model C. Unbounded steepest descent D. A fixed-gain controller with no tuning Correct Answer: A. Bayesian optimization Question 8What is the principal role of mutation in a genetic algorithm? A. To remove all population diversity B. To introduce new variation into candidate solutions C. To calculate the Hessian exactly D. To enforce closed-loop stability automatically Correct Answer: B. To introduce new variation into candidate solutions Question 9If a normalized candidate has JIAE=2.4, JIAE,ref=3.0, Ju=18, and Ju,ref=20, with cost J=JIAE/JIAE,ref+0.05Ju/Ju,ref, what is its cost? A. 0.245 B. 0.800 C. 0.845 D. 1.650 Correct Answer: C. 0.845 Question 10Why should an optimized controller be tested with disturbances and parameter variations not used during optimization? A. To increase the number of controller parameters B. To assess robustness and detect overfitting C. To guarantee that penalties are unnecessary D. To eliminate actuator limits Correct Answer: B. To assess robustness and detect overfitting
|