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

Enable Constraint Restriction and Set Tags #241

Open
pulsipher opened this issue Feb 28, 2022 · 0 comments
Open

Enable Constraint Restriction and Set Tags #241

pulsipher opened this issue Feb 28, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@pulsipher
Copy link
Collaborator

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.

@pulsipher pulsipher added the enhancement New feature or request label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant