JuMP enables users to define set constraints the following two ways:
julia> model = InfiniteModel();
julia> @infinite_parameter(model, t in [0, 1]);
julia> @variable(model, x[1:2], Infinite(t));
julia> y = [0.5, 0.75];
julia> @constraint(model, x >= y, MOI.Nonnegatives(2))
[x[1](t) - 0.5, x[2](t) - 0.75] ∈ MathOptInterface.Nonnegatives(2), ∀ t ∈ [0, 1]
julia> @constraint(model, x - y in MOI.Nonnegatives(2))
[x[1](t) - 0.5, x[2](t) - 0.75] ∈ MathOptInterface.Nonnegatives(2), ∀ t ∈ [0, 1]
In the latter syntax we can add DomainRestrictions, but we cannot with the first since no additional arguments can be accepted. One workaround would be to make some hybrid tag object, for example:
@constraint(model, x >= y, MultiTag(MOI.Nonnegatives(2), DomainRestrictions(t => [0, 0.5]))
However, this doesn't seem like the most elegant solution. @odow Any thoughts?
Ideally, it would be nice to add keyword arguments to @constraint, but I don't believe this is currently possible.
JuMP enables users to define set constraints the following two ways:
In the latter syntax we can add
DomainRestrictions
, but we cannot with the first since no additional arguments can be accepted. One workaround would be to make some hybrid tag object, for example:However, this doesn't seem like the most elegant solution. @odow Any thoughts?
Ideally, it would be nice to add keyword arguments to
@constraint
, but I don't believe this is currently possible.