You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is, however, supported in @expression
Current workaround is to use the ternary operator in @expression and then use that expression to build the needed constraints.
Not sure what you mean? This shouldn't work in @expression because it doesn't support exp.
The correct way to write this is:
julia> model =Model()
A JuMP Model
Feasibility problem with:
Variables:0
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
julia>@variable(model, x)
x
julia>@NLconstraint(model, [i=1:2], ifelse(i ==1, exp(x), x^2) <=0)
2-element Vector{NonlinearConstraintRef{ScalarShape}}:ifelse(1.0==1.0, exp(x), x ^2.0) -0.0≤0ifelse(2.0==1.0, exp(x), x ^2.0) -0.0≤0
It would be great to do something like this:
Currently, this gives the error:
This is, however, supported in
@expression
(the macro below does work):Tested in JuMP v.1.6.0
Current workaround is to use the ternary operator in
@expression
and then use that expression to build the needed constraints.The text was updated successfully, but these errors were encountered: