Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

4.7 Running and Terminal Objectives

The Bolza form separates accumulated and endpoint value

A general finite-horizon objective is

J=Φ(p,c,a,x(tf),z(tf))+t0tfL(t,p,c,a,x,z,u,d)dt.J=\Phi\bigl(p,c,a,x(t_f),z(t_f)\bigr) +\int_{t_0}^{t_f}L(t,p,c,a,x,z,u,d)\,\mathrm dt.

The running objective LL accumulates value or penalty over time. The terminal objective Φ\Phi evaluates the final state or design. For the positioner,

L=we(qr)2+wvv2i2+wmmtotal(p,a)/T,L=w_e(q-r)^2+w_vv^2i^2+w_m\,m_{\mathrm{total}}(p,a)/T,

and

Φ=wf(q(tf)r(tf))2+wωω(tf)2.\Phi=w_f(q(t_f)-r(t_f))^2+w_\omega\omega(t_f)^2.

The mass term is time independent; dividing by the horizon T=tft0T=t_f-t_0 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

Jh=Φ+k=0NwkL(tk,p,c,a,xk,zk,uk,dk).J_h=\Phi+\sum_{k=0}^{N}w_kL(t_k,p,c,a,x_k,z_k,u_k,d_k).

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,
})

Activity 4.7: change the objective