Model Predictive and Intelligent Optimal ControlIntroductionModel predictive control (MPC) is an optimization-based control method that repeatedly uses a model of a dynamic system to predict future behavior, computes an optimal sequence of control actions, and applies only the first action before solving the problem again. This repeated procedure is called receding-horizon control. MPC is especially valuable in mechatronics because mechanical, electrical, thermal, hydraulic, and software constraints must often be satisfied simultaneously. Intelligent optimal control extends this framework by incorporating learned models, online adaptation, heuristic optimization, reinforcement learning, fuzzy inference, or neural approximators. These tools can improve performance when first-principles models are incomplete, but they also introduce risks involving prediction error, computational burden, safety, explainability, and stability. A sound engineering design therefore combines optimization with model validation, constraint management, monitoring, and fallback control. Learning ObjectivesBy the end of this chapter, students should be able to: - Explain the architecture and operating principle of MPC.
- Formulate prediction models, horizons, objective functions, and constraints.
- Distinguish feasibility, stability, robustness, and computational performance.
- Solve and interpret a basic linear MPC problem.
- Explain how learned models and intelligent optimizers can be integrated safely.
- Evaluate an MPC design for a realistic mechatronic application.
1. Predictive Control as Repeated OptimizationConsider a discrete-time plant represented by xk+1 = f(xk,uk,dk), yk = h(xk) where xk is the state vector, uk is the manipulated-input vector, dk represents disturbances, and yk is the measured output. The functions f and h describe the process dynamics and measurement relationship. For a linear time-invariant model, xk+1 = A xk + B uk,
yk = C xk + D uk. Here, A, B, C, and D are matrices with dimensions determined by the numbers of states, inputs, and outputs. The model is applicable when sampling is sufficiently fast and system behavior is adequately approximated as linear over the operating region. At time k, MPC predicts states over a prediction horizon Np and optimizes future inputs over a control horizon Nc. Usually Nc ≤ Np. Only the first calculated input is applied. At time k+1, new measurements are obtained, the state is estimated, and the optimization is repeated. This feedback structure gives MPC three important capabilities: - anticipation of future reference changes and disturbances;
- explicit handling of input, state, and output constraints;
- coordinated control of multiple variables and actuators.
MPC is not simply an open-loop optimizer. Re-optimization using fresh measurements makes it a feedback controller. 2. Horizons and Prediction ModelsThe sampling period Ts determines how frequently the controller updates. A horizon that is too short may fail to see important future consequences; a horizon that is too long increases computational effort and may amplify modeling errors. A useful initial rule is to choose Np Ts long enough to cover the dominant settling or transport time of the process, then verify performance through simulation. The control horizon determines how many independent future moves are optimized. After Nc, the input may be held constant or follow a specified terminal policy. Reducing Nc lowers the number of decision variables while often preserving useful performance. State estimationMPC requires the current state, but not every state is directly measured. A state estimator, observer, or Kalman filter may provide an estimate \hat{x}k. For a linear Gaussian model, a Kalman filter is optimal in the minimum mean-square-error sense under its assumptions: linear dynamics, known noise statistics, and appropriate covariance modeling. Poor sensor calibration, unmodeled disturbances, or incorrect noise covariances can nevertheless produce unreliable estimates. Model formsCommon prediction models include: | Model | Strength | Limitation |
|---|
| First-principles state-space | Physical interpretation and extrapolation | Requires parameters and simplifying assumptions | | Linearized state-space | Efficient online optimization | Valid only near an operating condition | | Transfer-function model | Convenient for input-output design | Less direct treatment of constraints and states | | System-identification model | Captures measured behavior | Depends on data quality and excitation | | Neural or hybrid model | Represents nonlinear effects | Requires validation and safe deployment |
A model used for prediction need not reproduce every physical detail. It must predict the variables relevant to control accurately over the region and time horizon in which it will be used. 3. The MPC Objective FunctionA standard quadratic tracking objective for a linear system is J = ∑i=1Np ||yk+i|k − rk+i||Q2 + ∑i=0Nc−1 ||Δuk+i|k||R2 + ||xk+Np|k − xs||P2. The notation yk+i|k means the output predicted for time k+i using information available at time k. The reference is r, and Δuk+i|k = uk+i|k − uk+i−1|k. The matrices Q, R, and P are weighting matrices, normally positive semidefinite for Q and P, and positive definite for R. The symbol ||z||W2 = zT W z. The terminal reference or target state is xs. The first term penalizes tracking error, the second discourages aggressive actuator movement, and the terminal term shapes the final predicted state. All terms must be dimensionally and economically meaningful. If position is measured in metres and motor voltage in volts, weights are needed to normalize their relative importance; otherwise the numerical scale of one variable may dominate the objective unintentionally. For regulation to a constant equilibrium, the steady-state pair satisfies xs = A xs + B us, rs = C xs + D us. These equations assume that a feasible equilibrium exists. If it does not, the controller must use soft constraints, integral action, disturbance estimation, or another strategy to avoid persistent offset. Constraint formulationTypical constraints are umin ≤ uk+i|k ≤ umax,
Δumin ≤ Δuk+i|k ≤ Δumax,
xmin ≤ xk+i|k ≤ xmax,
ymin ≤ yk+i|k ≤ ymax. Input constraints represent actuator saturation, current limits, valve travel, or motor voltage. Rate constraints represent slew limits and protect mechanical components. State and output constraints can represent temperature, position, pressure, collision clearance, or human-safe force. A hard constraint must never be violated by a feasible solution. A soft constraint introduces a nonnegative slack variable ε and penalizes its use: ymin − εi ≤ yi ≤ ymax + εi, εi ≥ 0,
Jsoft = J + ρ ∑i=1Np εi2. The penalty ρ should be sufficiently large to discourage violation, but not so large that numerical conditioning becomes poor. Slack variables are appropriate when temporary violation is safer than optimization failure; they are not a substitute for genuinely non-negotiable safety limits. 4. Linear-Quadratic MPC and Quadratic ProgrammingFor a linear model, the predicted states can be written as an affine function of the current state and future inputs. For example, with a two-step prediction, xk+1|k = A xk + B uk|k,
xk+2|k = A2 xk + A B uk|k + B uk+1|k. Substitution into the objective produces a quadratic function of the decision vector U = [uk|kT, uk+1|kT, …, uk+Nc−1|kT]T. The optimization commonly takes the form minimize ½ UT H U + gT U subject to G U ≤ b + E xk. Here H is the Hessian matrix, g is a gradient vector, and the inequality represents predicted constraints. If H is positive semidefinite, the problem is convex; if it is positive definite over the decision variables, the unconstrained minimizer is unique. Convex quadratic programs can be solved reliably using specialized numerical methods. Worked example: one-step predictive controlConsider the scalar discrete-time plant xk+1 = 0.8xk + 0.5uk. At the current instant, xk = 1 and the desired next state is r = 0. Let the one-step objective be J(uk) = (xk+1 − r)2 + 0.2uk2, with input constraint −1 ≤ uk ≤ 1. Substitution gives J(uk) = (0.8 + 0.5uk)2 + 0.2uk2 = 0.64 + 0.8uk + 0.45uk2. Differentiating and setting the derivative to zero gives dJ/duk = 0.8 + 0.9uk = 0,
uk^* = −0.8889. This value satisfies the input constraint. The predicted next state is xk+1 = 0.8 + 0.5(−0.8889) ≈ 0.3556. The controller does not apply a complete future sequence in this example: it applies uk = −0.8889, measures the next state, and solves again. If the unconstrained optimum had been outside [−1,1], the constrained optimum would lie at the appropriate boundary, provided the objective is convex. 5. Feasibility, Stability, and RobustnessRecursive feasibilityAn MPC problem is feasible at a given state if at least one input sequence satisfies all constraints and model equations. Recursive feasibility means that feasibility is preserved at future sampling instants under the designed control law. It is not guaranteed merely because the current optimization has a solution. Common methods for improving recursive feasibility include: - terminal sets that are positively invariant under a local controller;
- terminal costs based on a stabilizing feedback law;
- constraint tightening to account for uncertainty;
- soft constraints for selected performance limits;
- disturbance invariant sets in robust MPC.
A set Xf is positively invariant under a policy if every state in the set remains in the set after the next closed-loop transition, subject to stated disturbances and constraints. StabilityClosed-loop stability concerns the behavior of the real system under repeated control actions, not merely the decrease of the numerical objective. A common theoretical construction uses a terminal cost and terminal invariant set. For a linear system with a local feedback law u = Kx, a quadratic terminal cost Vf(x)=xT P x can be selected using a discrete-time Lyapunov inequality such as (A + B K)T P (A + B K) − P ≤ −QK, where P > 0 and QK > 0. This condition indicates decrease of the terminal Lyapunov function under the local controller. The exact theorem requires compatible terminal constraints, model assumptions, and a feasible equilibrium. RobustnessReal plants differ from models because of parameter uncertainty, disturbances, delays, quantization, friction, wear, and unmeasured loads. Robust MPC explicitly or implicitly accounts for these effects. Approaches include: - min-max MPC, which optimizes against worst-case uncertainty;
- tube MPC, which plans a nominal trajectory and keeps errors within a robust tube;
- stochastic MPC, which constrains probabilities of violation;
- online disturbance estimation and adaptive model updating.
Robustness has a cost: conservative constraints, larger computation, or reduced nominal performance. A design should quantify the uncertainty set rather than use arbitrary safety margins. 6. Nonlinear and Intelligent MPCFor nonlinear systems, xk+1 = f(xk,uk), the optimization is generally nonlinear and may be nonconvex. Nonlinear MPC (NMPC) can use the full nonlinear model, sequential quadratic programming, interior-point methods, or multiple-shooting formulations. It can represent phenomena such as robotic joint coupling, vehicle tire saturation, magnetic forces, and actuator dead zones more faithfully than linear MPC. A practical alternative is successive linearization: the model is linearized around the current predicted trajectory and a quadratic program is solved repeatedly. This is computationally attractive but can fail when the operating point changes rapidly or the linearization is poor. Learned modelsA learned predictor may take the form \hat{x}k+1 = f_θ(xk,uk), where θ denotes parameters learned from data. Neural networks, Gaussian processes, sparse regression, and ensemble models are possible choices. A hybrid model combines known physics with a learned residual: xk+1 = fphysics(xk,uk) + g_θ(xk,uk). Hybrid models are often preferable when conservation laws, actuator structure, or known geometry should not be discarded. Training data must cover the operating conditions relevant to control. Random prediction accuracy on an average test set is insufficient: errors near constraints and under unusual disturbances may be more important than average error. Model-learning workflow: - Define safe operating and data-collection conditions.
- Collect persistently informative data without unsafe excitation.
- Separate training, validation, and independent test data by operating condition.
- Quantify multi-step prediction error, not only one-step error.
- Propagate uncertainty through the prediction horizon.
- Validate closed-loop behavior in simulation and hardware-in-the-loop.
- Deploy with monitoring, bounds, and a verified fallback controller.
Intelligent optimizersGenetic algorithms, particle swarm optimization, ant-colony methods, and other metaheuristics can optimize nonconvex objectives or controller parameters. They may be useful offline for tuning weights, identifying schedules, or designing trajectories. They are less attractive for a fast inner control loop when deterministic timing is required. A heuristic may return a good solution without proving optimality, feasibility, or repeatability. Reinforcement learning can learn a policy by maximizing expected cumulative reward. However, unconstrained exploration is inappropriate for many physical systems. A safer architecture uses reinforcement learning for high-level references, adaptation, or warm starts while a constraint-aware MPC layer remains responsible for actuator and safety limits. 7. Real-Time ImplementationA controller is useful only if it finishes computation before the next sample. If the sampling period is Ts and worst-case computation time is Tc, a basic timing requirement is Tc < Ts, with additional margin for communication, state estimation, operating-system scheduling, and fault handling. Average execution time is not enough for a safety-critical design; worst-case or suitably bounded execution time matters. Important implementation choices include: - scaling states, inputs, and constraints to comparable numerical magnitudes;
- warm-starting the solver with the previous solution shifted by one step;
- reducing horizons only after checking closed-loop performance;
- using sparse matrices for large prediction models;
- selecting fixed-step, deterministic software where needed;
- logging solver status, constraint activity, latency, and model residuals.
A failed optimization should not leave the actuator undefined. The system needs a fault response, such as the last feasible input, a safe braking action, or a certified backup controller. This response must be designed and tested rather than improvised in software. 8. Applied Case: Predictive Temperature and Motion Control of a Heated Positioning StageThe following is an illustrative engineering case. BackgroundA precision positioning stage uses a motor and a resistive heater. Motor friction and thermal expansion change with temperature, causing position error. The actuator has limited voltage, and rapid voltage changes cause electrical stress. ProblemA conventional position controller maintains acceptable performance at constant temperature but produces overshoot during a rapid temperature change. The design must regulate position while preventing excessive motor voltage and heater power. AnalysisAn identified discrete model includes position, velocity, and temperature states: xk+1 = A xk + B uk + E dk, where uk contains motor voltage and heater command, and dk contains measured ambient temperature. Constraints include motor voltage limits, heater limits, voltage slew limits, and a maximum allowable temperature. Position and temperature are measured; velocity is estimated. A prediction horizon of 20 samples is selected after observing that the dominant thermal response takes approximately 15 sampling intervals. The control horizon is 5 samples, after which inputs are held constant. The objective weights position tracking strongly, temperature deviation moderately, and input changes to limit electrical stress. Approach and solutionA linear MPC controller is first tested. Temperature-dependent friction produces a systematic prediction residual. A hybrid model is then introduced: the physical state-space model predicts nominal behavior and a small neural residual predicts friction-related error. The residual is bounded using validation data. Constraint tightening reserves margin for this error. The real-time architecture is: - acquire position, temperature, and ambient measurements;
- estimate velocity and update the model residual;
- solve the constrained MPC problem;
- verify solver status and predicted constraints;
- apply the first motor and heater commands;
- switch to a verified fallback controller if computation or validation fails.
OutcomeIn simulation and hardware-in-the-loop testing, the predictive controller reduces position overshoot during thermal transients and respects actuator limits. The learned residual improves prediction only in the validated temperature range. Outside that range, the supervisory logic disables the residual and uses the physical model with conservative margins. Learning pointsThe case illustrates that intelligent modeling is most effective when it complements, rather than replaces, physical knowledge. It also shows that performance metrics must include constraint violations, worst-case latency, recovery from infeasibility, and behavior outside the training distribution. 9. Evaluation Metrics and Engineering Trade-offsPerformance should be evaluated using several metrics rather than tracking error alone. A commonly used tracking measure is the root-mean-square error: RMSE = √[(1/N) ∑k=1N(yk − rk)2], where N is the number of samples. Units are the same as the output variable. Other useful measures include maximum overshoot, settling time, integral absolute error, total actuator variation, energy consumption, percentage of active constraints, solver failure rate, and worst-case computation time. An intelligent MPC design should be compared against a credible baseline such as PID, linear quadratic control, or ordinary linear MPC. Claims of improvement should use identical disturbances, initial conditions, actuator limits, and evaluation data. Statistical comparisons are useful when disturbances are stochastic, but engineering significance and safety remain essential. 10. Ethical, Safety, and Governance ConsiderationsA controller that influences a robot, collaborative machine, medical device, or autonomous vehicle can cause physical harm. Responsibility therefore extends beyond algorithmic performance. Engineers should: - define operating envelopes and prohibited states;
- provide independent emergency-stop and safety-rated functions;
- prevent learned models from overriding hard safety interlocks;
- retain traceable software versions, data, parameters, and solver logs;
- test sensor failure, communication loss, actuator saturation, and model extrapolation;
- document who may modify models and constraints;
- protect operational data and assess cybersecurity threats.
Formal safety functions should not rely solely on a probabilistic prediction or an opaque optimizer. Where applicable, development should follow relevant machinery, functional-safety, automotive, aerospace, or medical-device standards. The exact standard depends on the application and jurisdiction. 11. Best-Practice Design ProcedureA disciplined workflow is: - Define outputs, manipulated variables, disturbances, constraints, and safety requirements.
- Establish sampling time from plant dynamics, sensing, and actuator bandwidth.
- Obtain and validate a model over the intended operating envelope.
- Select horizons based on dynamic response and computational resources.
- Scale variables and choose objective weights with physical justification.
- Test feasibility under nominal and disturbed conditions.
- Add terminal ingredients, constraint tightening, or soft constraints as appropriate.
- Benchmark solver time, memory, and worst-case behavior.
- Add learned components only after establishing a reliable baseline.
- Validate in simulation, hardware-in-the-loop, and controlled physical experiments.
- Implement monitoring, fallback control, data logging, and maintenance procedures.
- Reassess the model when the plant, firmware, sensors, or operating environment changes.
Contemporary DevelopmentsCurrent research includes differentiable optimization layers, safe reinforcement learning, distributed MPC for interconnected systems, event-triggered updates, embedded GPU and FPGA solvers, Gaussian-process uncertainty models, and formal verification of neural components. These developments are promising but do not eliminate the need for model validation and constraint reasoning. A sophisticated algorithm with uncertain timing or unbounded extrapolation may be less suitable than a simpler, certifiable controller. Chapter SummaryModel predictive control predicts future system behavior, optimizes a finite sequence of actions, and applies the first action in a receding-horizon loop. Its main design elements are the prediction model, sampling period, prediction and control horizons, objective function, constraints, state estimator, and numerical solver. Linear MPC commonly leads to a constrained quadratic program, whereas nonlinear MPC requires nonlinear optimization. Feasibility means that an admissible control sequence exists; recursive feasibility concerns continued existence of such a sequence. Stability can be supported by terminal costs, invariant sets, and Lyapunov conditions. Robust MPC addresses disturbances and model uncertainty, often at the cost of conservatism or computation. Learned and hybrid models can improve prediction, particularly when physical models omit friction, aging, or nonlinear effects. They must be trained on relevant data, validated for multi-step prediction, bounded under uncertainty, and protected by safety constraints and fallback control. Intelligent optimizers are often most useful for offline tuning or supervisory decisions when deterministic real-time execution is required. A professional MPC implementation evaluates tracking, constraint satisfaction, energy, latency, solver reliability, and fault recovery. Safety, traceability, cybersecurity, and responsible deployment are integral engineering requirements rather than optional additions. Key TermsModel predictive control: Feedback control based on repeated finite-horizon optimization. Receding horizon: Strategy of applying only the first optimized input and resolving at the next sample. Prediction horizon: Number of future sampling steps included in prediction. Control horizon: Number of future input moves optimized independently. State estimator: Algorithm that reconstructs unmeasured states from measurements and a model. Objective function: Quantitative criterion minimized by the controller. Hard constraint: Requirement that cannot be violated by a feasible solution. Soft constraint: Constraint whose violation is allowed through a penalized slack variable. Quadratic program: Optimization problem with a quadratic objective and linear constraints. Recursive feasibility: Preservation of optimization feasibility during closed-loop operation. Terminal cost: Cost assigned to the state at the end of the prediction horizon. Terminal set: Constraint set used to support feasible and stable terminal behavior. Robust MPC: MPC designed to account explicitly for uncertainty or disturbances. Tube MPC: Robust method that maintains trajectories within an uncertainty tube. Nonlinear MPC: Predictive control using nonlinear system and/or constraint models. Hybrid model: Model combining physical equations with learned components. Model residual: Difference between measured behavior and a nominal model prediction. Warm start: Initialization of an optimization solver using a previous solution. Fallback controller: Verified controller used when the primary controller fails or becomes unsafe. Review QuestionsShort Answer Questions- What is the receding-horizon principle?
- Distinguish prediction horizon from control horizon.
- Why are input-rate constraints important in mechatronic systems?
- What is the purpose of a slack variable?
- Why does a learned model require validation outside one-step prediction accuracy?
Long Answer Questions- Explain the formulation of a linear MPC problem, including its model, objective function, constraints, and solver form.
- Discuss recursive feasibility and stability, including the role of terminal costs and terminal sets.
- Compare linear MPC, nonlinear MPC, robust MPC, and hybrid learned-model MPC.
- Describe a complete real-time implementation architecture for an MPC-controlled robot or positioning system.
- Evaluate the benefits and risks of using metaheuristic optimization or reinforcement learning within an industrial control system.
Analytical / Application Questions- For xk+1=0.8xk+0.5uk, xk=1, and J=(xk+1)2+0.2uk2, calculate the unconstrained one-step optimal input and determine whether it satisfies −1≤uk≤1.
- Design a constraint and objective structure for a two-input robotic actuator whose position must track a reference while motor current, temperature, and input slew rate are limited.
- A learned predictor improves average validation error but occasionally violates temperature predictions near the operating limit. Propose a deployment strategy that preserves safety and explain which tests are required before physical operation.
Multiple Choice Questions with AnswersQuestion 1What distinguishes MPC from open-loop finite-horizon optimization? A. MPC applies the entire optimized input sequence without measurement updates. B. MPC repeatedly re-optimizes using new measurements and applies only the first input. C. MPC does not require a model of the plant. D. MPC can never include actuator constraints. Correct Answer: B. MPC repeatedly re-optimizes using new measurements and applies only the first input. Question 2In a standard quadratic MPC objective, what does the term involving Δu primarily penalize? A. State-estimation bias B. Prediction-horizon length C. Rapid actuator movement D. Sensor sampling noise only Correct Answer: C. Rapid actuator movement Question 3For the scalar example in the chapter, with x_k = 1 and J = (0.8 + 0.5u_k)^2 + 0.2u_k^2, what is the unconstrained optimum? A. −0.8889 B. −0.5000 C. 0.3556 D. 0.8889 Correct Answer: A. −0.8889 Question 4What is a hard constraint? A. A constraint whose violation is always permitted with a penalty B. A requirement that must not be violated by a feasible solution C. A constraint used only during model training D. A constraint that applies only after shutdown Correct Answer: B. A requirement that must not be violated by a feasible solution Question 5Which condition is most directly associated with recursive feasibility? A. The current optimization has at least one admissible solution at every future step under the designed operation. B. The objective contains no input penalty. C. The model has no disturbances. D. The sampling period is infinite. Correct Answer: A. The current optimization has at least one admissible solution at every future step under the designed operation. Question 6Why might a hybrid physical-learned model be preferred to a purely data-driven model? A. It removes the need for validation. B. It guarantees zero prediction error. C. It preserves known physical structure while learning unmodeled effects. D. It always requires more computation than nonlinear MPC. Correct Answer: C. It preserves known physical structure while learning unmodeled effects. Question 7If the sampling period is T_s and worst-case computation time is T_c, which basic real-time requirement is appropriate? A. T_c > T_s B. T_c = 10T_s C. T_c < T_s, with additional implementation margin D. T_c is irrelevant if average error is small Correct Answer: C. T_c < T_s, with additional implementation margin Question 8Which method explicitly introduces a nonnegative variable to permit a selected constraint violation at a penalty? A. Soft-constrained MPC B. Open-loop pole placement C. Unconstrained least squares D. Static feedforward control Correct Answer: A. Soft-constrained MPC Question 9What is the main purpose of a fallback controller in an intelligent MPC implementation? A. To increase the neural network training set during operation B. To define a safe response when optimization or validation fails C. To remove all actuator constraints D. To replace state estimation permanently Correct Answer: B. To define a safe response when optimization or validation fails Question 10Which evaluation measure has the same units as the controlled output? A. RMSE of output tracking error B. Number of prediction variables C. Solver iteration count D. Dimension of the Hessian matrix Correct Answer: A. RMSE of output tracking error
|