Quadratic Costs

Utilities for building and solving quadratic control‑cost problems in the MultiAgentTracking submodule.

CellularSheaves.ControlSheaves.MultiAgentTracking.QuadraticCosts.build_control_cost_matrixMethod
build_control_cost_matrix(prob::TrackingProblem, stalks, cost_func::Function) -> SparseMatrixCSC{Float64,Int}

Construct a global quadratic cost matrix Q using a user‑provided function cost_func(agent_idx, t_step) -> Q_local.

  • prob – the TrackingProblem describing the agents, dynamics, etc.
  • stalks – the sheaf's vertex_stalks, giving the DOF layout Q is built for.
  • cost_func – a function (agent_idx, t_step) -> Q_local where Q_local is a nu × nu positive semidefinite matrix for that agent at that timestep.

The returned matrix has size total_dim × total_dim where total_dim = sum(stalks). The control block is read from stalks (the trailing nu DOFs of each agent vertex), so an agent vertex that carries state only — e.g. the t = 0 vertex of the MPC-window sheaf — has no control DOFs and is skipped automatically.

source
CellularSheaves.ControlSheaves.MultiAgentTracking.QuadraticCosts.solve_quadratic_on_basisMethod
solve_quadratic_on_basis(point::AbstractVector, basis::AbstractMatrix,
                             Q::AbstractMatrix) -> Vector{Float64}

Given a solution point, a matrix N whose columns span the space of constraints, and a global quadratic cost matrix Q, solve the reduced system

(N' * Q * N) * α = -N' * Q * point

and return the optimal full‑state vector z_opt = point + N * α. If the nullspace dimension is zero the original solution is returned unchanged.

source