Skip to content

Commit

Permalink
typo fix - tests pass. needs test for AD
Browse files Browse the repository at this point in the history
  • Loading branch information
dfridovi committed Nov 26, 2024
1 parent 50dcee5 commit aeeca52
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/mcp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
functions G(.) and H(.) such that
0 = G(x, y; θ)
0 ≤ H(x, y; θ) ⟂ y ≥ 0.
# 2B
The primal-dual system arises when we introduce slack variable `s` and set
G(x, y; θ) = 0
H(x, y; θ) - s = 0
Expand Down Expand Up @@ -97,21 +97,21 @@ function PrimalDualMCP(
(x, y, s; θ, ϵ) -> _∇F([x; y; s; θ; ϵ])
end

∇F_θ = if !compute_sensitivities
nothing
else
∇F_symbolic = SymbolicUtils.sparse_jacobian(F_symbolic, θ_symbolic)
_∇F = SymbolicUtils.build_function(
∇F_symbolic,
[z_symbolic; θ_symbolic; ϵ_symbolic];
in_place = false,
backend_options,
)

(x, y, s; θ, ϵ) -> _∇F([x; y; s; θ; ϵ])
end

PrimalDualMCP(F, ∇F_z, ∇F_Θ, length(x_symbolic), length(y_symbolic))
∇F_θ =
!compute_sensitivities ? nothing :
let
∇F_symbolic = SymbolicUtils.sparse_jacobian(F_symbolic, θ_symbolic)
_∇F = SymbolicUtils.build_function(
∇F_symbolic,
[z_symbolic; θ_symbolic; ϵ_symbolic];
in_place = false,
backend_options,
)

(x, y, s; θ, ϵ) -> _∇F([x; y; s; θ; ϵ])
end

PrimalDualMCP(F, ∇F_z, ∇F_θ, length(x_symbolic), length(y_symbolic))
end

""" Construct a PrimalDualMCP from `K(z; θ) ⟂ z̲ ≤ z ≤ z̅`, where `K` is callable.
Expand Down

0 comments on commit aeeca52

Please sign in to comment.