From d3e934693394b21fc4ba42f09c836bdd9fb881cf Mon Sep 17 00:00:00 2001 From: dfridovi Date: Mon, 18 Nov 2024 07:58:13 -0600 Subject: [PATCH] adding last ctor for compatibility with parametricmcps --- src/mcp.jl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/mcp.jl b/src/mcp.jl index 8fb2f11..0fcc3d2 100644 --- a/src/mcp.jl +++ b/src/mcp.jl @@ -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. """