Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/ConicProgram/ConicProgram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,23 @@ function MOI.get(
i = vi.value
du = model.forw_grad_cache.du
dw = model.forw_grad_cache.dw
# From https://arxiv.org/pdf/1904.09043, we have
# dx = du - (dw)x
# we just need to flip the sign due to different conventions.
return -(du[i] - model.x[i] * dw[])
end

function MOI.get(
model::Model,
::DiffOpt.ForwardConstraintDual,
ci::MOI.ConstraintIndex{MOI.VectorAffineFunction{Float64},S},
) where {S}
i = MOI.Utilities.rows(model.model.constraints, ci) # vector
# From https://arxiv.org/pdf/1904.09043, we have
# dy = DΠ(v)dv - (dw)y
return DΠ(v) * dv - dw[] * model.y[i]
end

function DiffOpt._get_db(
model::Model,
ci::MOI.ConstraintIndex{F,S},
Expand Down