[Dev] Expose the duals of the JuMP path, boundary and box constraints, aligned with signs.md

未关闭
#430 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@ocots 已经在做这个了。

开始于 2026年11月8日。

评估

这个 Issue 还没有评估数据。

描述

Context

#326 aligns the sign of the JuMP costate with OptimalControl (ct-conventions rules/signs.md, SGN1–SGN6, v0.11.0): the normalized multiplier of a constraint row is -JuMP.dual(ref), for a Min and a Max model alike. Today only the dynamics constraints are exposed — their duals are read as the costate. The duals of the other constraints the JuMP models create exist but are never read:

  • path constraints: lower <= g(x, u, v, t) <= upper rows, built at every node;
  • boundary constraints: lower <= g(x0, xf, v) <= upper rows;
  • box bounds on the state, control and variable components (LowerBoundRef / UpperBoundRef).

All of them are concatenated in model[:constraints] (dynamics, path, boundary); build.jl would have to keep the refs per group to expose them.

What to do (later)

  • Expose the duals of the path and boundary constraints, and of the box bounds, normalized as the costate (-JuMP.dual).
  • Conventions to apply (rules/signs.md v0.11.0):
    • SGN3: a two-sided row l ≤ c ≤ u carries one signed multiplier y = μU − μL (≥ 0 upper active, ≤ 0 lower active) — a JuMP Interval constraint gives one signed dual, mapped by -dual;
    • SGN2: for a box bound or a single-bounded row, the dual is the multiplier of that side, ≥ 0 — i.e. -dual(LowerBoundRef) / -dual(UpperBoundRef) give the nonnegative per-side values;
    • SGN5: the same constraint declared as a path constraint or as a box must have the same dual — the comparison tests should check it;
    • the scale of a time-dependent dual (density vs raw multiplier) is free in SGN5 — CTDirect divides the path multipliers by h; choose the same here for consistency.
  • Follow the ecosystem design for reading duals by constraint label (dual(sol, model, label)): CTModels.jl#105, CTFlows.jl#314 and discussion #312 — this issue waits for it, as #326 did for the costate.

Tests

Extend the sign tests of #326 (two layers, SGN6): the normalized duals must satisfy ∇F + Jᵀy = 0 on hand-written JuMP problems with known multipliers — active lower and upper sides of a two-sided row, bounds of variables, min f vs max -f (SGN1) — and match the OptimalControl duals of the same problem where both are exposed.

Related

#326, #170, control-toolbox/CTDirect.jl#405, control-toolbox/CTModels.jl#105.

主要语言
Julia
星标
13
派生
1
平均合并
3 小时 33 分钟
30 天内合并 PR
55

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

control-toolbox/OptimalControlProblems.jl 的其他 Issue

查看 control-toolbox/OptimalControlProblems.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。