Mpc#

Short-Horizon MPC Optimizer#

Model-Predictive Control (MPC) over a short horizon. Optimizes control-like parameters (e.g., alpha) by rolling out a few steps ahead, minimizing the cumulative cost with a small action penalty. Uses simple projected gradient descent over the horizon (can be swapped for a QP solver later).

Interface:
  • initialize(params) -> state

  • step_params(model, params, context) -> (new_params, state)

Context:
  • context[“rollout_fn”](model, params, horizon, context) -> (traj_info, cum_loss) where cum_loss already aggregates Task + Cons + Coh + action_penalty.

  • “horizon”: int, number of predictive steps (default 3)

  • Optional: “project_fn”(params) to project back to feasible set.

class qmlhc.optim.numpy_optim.mpc.HCMPCShortHorizon(lr=0.01, horizon=3, clip=None)[source]#

Bases: object

Short-horizon MPC with simple gradient descent over cumulative loss.

initialize(params)[source]#
Return type:

Dict[str, Any]

step_params(model, params, context)[source]#
Return type:

Tuple[Dict[str, Any], Dict[str, Any]]