Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to add support for PSD constraints in square form in future release #73

Open
bcdandurand opened this issue Jan 9, 2020 · 6 comments

Comments

@bcdandurand
Copy link

In applying Dualization in our project, I found that support is provided for PSD constraints in triangular form but not in square form. May I request that support for PSD in square form also be provided in a future release? If this is feasible?

I can use Dualization for our purposes still, but I need to modify my local version of other third party Julia packages to post PSD constraints in triangular form rather than square form, and so my rationale for this request is for the sake of minimizing the potential need to modify third party code in the future. Thank you.

@blegat
Copy link
Member

blegat commented Jan 9, 2020

You can use a bridge layer on top of Dualization (e.g. with MOI.Bridges.full_bridge_optimizer) so that the square PSD constraint is automatically transformed to a triangle PSD one. Supporting square PSD cones natively in Dualization would require defining its dual set (see https://github.com/JuliaOpt/MathOptInterface.jl/blob/2a8603407fdabce4f322cd90fe646f3a0efdc6a6/src/Bridges/Constraint/square.jl#L1-L35 for a description of it)

@bcdandurand
Copy link
Author

The use of the MOI bridge interface seems to be sensible. I'm attempting the use of the bridge interface, but I need time to learn how to apply this with Dualization if there aren't examples already. I need to return to other tasks now, but at some point, I may post what I'm attempting to do.

@guilhermebodin
Copy link
Collaborator

guilhermebodin commented Feb 4, 2020

I am tagging the issue as documentation, Try to write a small script with a PSD square and dualize it using bridges

@guilhermebodin guilhermebodin added the docs Documentation issues and requests label Feb 4, 2020
@blegat
Copy link
Member

blegat commented Feb 4, 2020

Using bridges outside a DualizationOptimizer may not work as expected because of #77.
IIRC, we use a bridge layer inside the DualizationOptimizer because when the optimizer did not support free variables, it meant the DualizationOptimizer did not support Zeros constraints but we were missing a Zeros bridge.
Now that it was added in jump-dev/MathOptInterface.jl#1005, we should not add a bridge layer inside DualizationOptimizer anymore.
The user should add a bridge layer on top of the DualizationOptimizer. This was made easier with MOI.instantiate(::MOI.AbstractOptimizer, with_bridge_type=Float64) added in jump-dev/MathOptInterface.jl#1008

@bcdandurand
Copy link
Author

I found something like the following function to provide a dualizable model, where the input jump_model has a square PSD constraint.

function DualizeModel(jump_model)
    dualizable_model = MOI.Utilities.Model{Float64}()
    bridged_model = MOI.Bridges.Constraint.Square{Float64}(dualizable_model)
    MOI.copy_to(bridged_model,backend(jump_model))
    dualized_problem = dualize(dualizable_model)
    dualized_model = JuMP.Model()
    MOI.copy_to(dualized_model,dualized_problem.dual_model)
    return dualized_model
end

@blegat
Copy link
Member

blegat commented Feb 5, 2020

That's indeed a valid workaround. MOI.Bridges.Constraint.Square{Float64} is a Bridges.Constraint.SingleBridgeOptimizer. This bridge optimizer bridges any constraint that can be bridged independently on whether the inner model supports it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants