Is there a way i can create LazySets Polyhedron and use it as a variable in my optimization program that uses Convex.jl, use them in constraints i want to add to the problem?.

I don’t think there’s any interoperability already set up for those two packages. I think you can use Polyhedra.jl to create a constraint for JuMP.jl, however: http://juliapolyhedra.github.io/Polyhedra.jl/stable/optimization/#Polyhedra.linear_objective_solver.

Thanks.

Hi @adropintheriver,

Integration of LazySets.jl types with JuMP is implemented in the package InvariantSets.jl (thanks to @uweschler). We should probably refactor that conversion code to LazySets.jl and make it available when users load JuMP.

With respecto to Convex.jl I’m not aware of such conversions but I guess it shouldn’t be too hard

(PRs welcome).

Nice! If InvariantSets.jl worked on the MathOptInterface (MOI) level instead of the JuMP level, then support for Convex should be even easier (since both Convex and JuMP are MOI frontends). MOI can be a bit harder to work with than JuMP though so maybe it’s not worth it.

Do you have a use case or MWE of the kind of problem you want to address?

Note that constraints can be added easily in this way:

```
using LazySets, Convex, SCS
function Convex.add_constraint!(x::Convex.AbstractVariable, X::LazySet)
A, b = tosimplehrep(X)
add_constraint!(x, A*x ≤ b)
end
```

Example use:

```
function supfunc(d::AbstractVector, X::LazySet; solver=SCS.Optimizer(verbose=false))
x = Variable(length(d))
add_constraint!(x, X) # x ∈ X
xᵀd = dot(x, d)
solve!(maximize(xᵀd), solver)
return evaluate(xᵀd)
end
X = rand(VPolygon)
d = ones(2)
supfunc(d, X) ≈ ρ(d, X) # ρ is defined on LazySets for each set / lazy operation
true
```