4.7 Running and Terminal Objectives
The Bolza form separates accumulated and endpoint value¶
A general finite-horizon objective is
The running objective accumulates value or penalty over time. The terminal objective evaluates the final state or design. For the positioner,
and
The mass term is time independent; dividing by the horizon prevents accidental multiplication by duration when it is placed inside the integral. It could equivalently be placed outside the integral.
Objectives should represent system value¶
Tracking error, energy, mass, cost, fatigue, and reliability have different units and stakeholder meanings. Normalize terms using meaningful reference quantities before selecting weights. A weight is not a substitute for a hard requirement: current, temperature, safety, and packaging limits generally remain constraints.
Quadrature produces the numerical objective¶
On a mesh, the integral becomes
Objective convergence must be checked as the mesh is refined.
import numpy as np
t = np.linspace(0.0, 2.0, 401)
reference = np.ones_like(t)
position = 1.0 - np.exp(-3.0 * t) * (np.cos(7.0 * t) + 0.25 * np.sin(7.0 * t))
voltage = 8.0 * np.exp(-2.0 * t)
current = 2.5 * np.exp(-2.4 * t)
tracking_running = np.trapz((position - reference) ** 2, t)
electrical_energy = np.trapz(np.maximum(voltage * current, 0.0), t)
terminal_error = (position[-1] - reference[-1]) ** 2
print({
"tracking integral": tracking_running,
"electrical energy": electrical_energy,
"terminal error": terminal_error,
})