Skip to content

Commit

Permalink
adding last ctor for compatibility with parametricmcps
Browse files Browse the repository at this point in the history
  • Loading branch information
dfridovi committed Nov 18, 2024
1 parent bb1f657 commit d3e9346
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/mcp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,26 @@ function PrimalDualMCP(
PrimalDualMCP(F, ∇F, length(x_symbolic), length(y_symbolic))
end

"""Construct a PrimalDualMCP from K(z) ⟂ z̲ ≤ z ≤ z̅.
"""Construct a PrimalDualMCP from `K(z) ⟂ z̲ ≤ z ≤ z̅`, where `K` is callable.
NOTE: Assumes that all upper bounds are Inf, and lower bounds are either
-Inf or 0.
"""
function PrimalDualMCP(
K,
lower_bounds::Vector,
upper_bounds::Vector;
backend = SymbolicUtils.SymbolicsBackend(),
backend_options = (;)
)
z_symbolic = SymbolicUtils.make_variables(backend, :z, length(lower_bounds))
K_symbolic = K(z_symbolic)

PrimalDualMCP(
K_symbolic, z_symbolic, lower_bounds, upper_bounds; backend_options)
end


"""Construct a PrimalDualMCP from symbolic `K(z) ⟂ z̲ ≤ z ≤ z̅`.
NOTE: Assumes that all upper bounds are Inf, and lower bounds are either
-Inf or 0.
"""
Expand Down

0 comments on commit d3e9346

Please sign in to comment.