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

support variable creation with NonNegPoly(X) #30

Open
chriscoey opened this issue Nov 3, 2018 · 1 comment
Open

support variable creation with NonNegPoly(X) #30

chriscoey opened this issue Nov 3, 2018 · 1 comment

Comments

@chriscoey
Copy link
Contributor

@variable(m, p, NonNegPoly(X))
perhaps also
@variable(m, p, NonNegPoly(X), domain=D)? (or maybe domain could be a second argument to NonNegPoly)

@blegat
Copy link
Member

blegat commented Nov 3, 2018

The type of the returned variable may depend on the type of the domain. For instance with SumOfSquares, it is MatPolynomial{JuMP.VariableRef} for a domain FullSpace while with a domain is will be Polynomial{AffExpr}.
If the domain is not in NonNegPoly then JuMP.variable_type will not be possible to implement because it should only depend on the type of positional arguments (see https://github.com/JuliaOpt/JuMP.jl/blob/64c5834412cb22dc7047e3edaf5bdc62d0303d3d/src/macros.jl#L1086).
However, using the domain keyword is more consistent with the @constraint macro.
We could return a Polynomial{AffExpr} in the case the domain is a FullSpace too (we just need to call polynomial on the MatPolynomial before returning it) so that the value of variable_type does not depend on the type of the domain.

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

2 participants