MathOptInterface.jl
MathOptInterface.jl copied to clipboard
[Nonlinear] Add support for more functions
@harshangrjn says that there are a bunch of functions in MINLPlib that AMPL supports that JuMP currently doesn't.
Some of them are listed here: https://github.com/jump-dev/MathOptInterface.jl/blob/2aba5d5450b3a5931ff557cb8969efc2987b3ffd/src/FileFormats/NL/NLExpr.jl#L30-L101 We should go through and reconsider the ones we've left out.
In addition, Harsha says he will link to a list of functions that he'd like added.
GAMS has a bunch here: https://www.gams.com/latest/docs/UG_Parameters.html
The univariate functions supported by JuMP/MOI are here: https://github.com/jump-dev/MathOptInterface.jl/blob/2aba5d5450b3a5931ff557cb8969efc2987b3ffd/src/Nonlinear/univariate_expressions.jl#L12-L83 the multivariate functions are here: https://github.com/jump-dev/MathOptInterface.jl/blob/2aba5d5450b3a5931ff557cb8969efc2987b3ffd/src/Nonlinear/operators.jl#L531-L547
A missing one that people use quite a bit is sign
(@ccoffrin has an example where this needs to be a registered function)
signpower(x, p)
-> sign(x) * abs(x)^p
for any real p > 1
A few examples where this nonlinearity appears:
- https://www.minlplib.org/gastransnlp.html (JuMP model)
- https://www.minlplib.org/waternd_fosspoly0.html (JuMP model)
Ah. They're in the GAMS format, not AMPL. We have an open question then, of whether to bring in modeling functions like signpower
that exist only in GAMS, and are not Julia functions. (Although I guess we could define MOI.Nonlinear.signpower
.)
Assuming sign
and abs
functions will be internally supported, writing signpower
as an explicit constraint by the user shouldn't be too much though.
I guess the issue is that signpower
is smooth and differentiable at x=0
. Whereas sign(x)
and abs(x)
are not.