How about using ifelse?
ifelse
See How to implement a piece-wise defined function in JuMP - #4 by odow