How can i use sets created using LasySets.jl with Convex.jl variables?

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
2 Likes