Quadratic Costs
Utilities for building and solving quadratic control‑cost problems in the MultiAgentTracking submodule.
CellularSheaves.ControlSheaves.MultiAgentTracking.QuadraticCosts.build_control_cost_matrix — Function
build_control_cost_matrix(prob::TrackingProblem, stalks, λ::Number) -> SparseMatrixCSC{Float64,Int}Construct a global quadratic cost matrix Q that penalises the control components of each agent with a uniform weight λ. Internally this builds a block‑diagonal matrix where each control block is λ * I(nu).
CellularSheaves.ControlSheaves.MultiAgentTracking.QuadraticCosts.build_control_cost_matrix — Method
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– theTrackingProblemdescribing the agents, dynamics, etc.stalks– the sheaf'svertex_stalks, giving the DOF layoutQis built for.cost_func– a function(agent_idx, t_step) -> Q_localwhereQ_localis anu × nupositive 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.
CellularSheaves.ControlSheaves.MultiAgentTracking.QuadraticCosts.solve_quadratic_on_basis — Method
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 * pointand return the optimal full‑state vector z_opt = point + N * α. If the nullspace dimension is zero the original solution is returned unchanged.