from gekko import GEKKO m = GEKKO() x = m.Var() y = m.if3(x,-x,2*x) m.Minimize(y) m.options.SOLVER = 1 m.solve() print(x.value,y.value)