Huber objective

Hi. I wanted to know if it is possible to place a Huber loss in the objective of a quadratic problem in JuMP 0.18.
The Huber function can be defined as follows:

huber(a,delta)= abs(a) <= delta ? 1/2*a^2 : delta*(abs(a)-1/2*delta)

For the absolute value, I can always use the trick of adding a slack variable z = abs(a) and use that:
@variable(m, z)
@constraint(m, z>=a)
@constraint(m, z<=-a)

But I don’t know how to solve the piecewise part. I get the following error:
MethodError: no method matching isless(::Float64, ::JuMP.Variable)

Is there a way to code this, or not currently supported? Thank you.

What you have in the objective function is a disjunction. They can be modeled and formulated with a few techniques such as the Big M. Check:

Raman, Ramesh, and Ignacio E. Grossmann. “Modelling and computational techniques for logic based integer programming.” Computers & Chemical Engineering 18, no. 7 (1994): 563-578.

Also check ConditionalJuMP, a package to will do the transformations for you.


1 Like

Thank you for the reference and the package. I’ll definitely try that one.