Skip to main content

L1 norm in objective function

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Yuriy Zinchenko
    • Gurobi Staff Gurobi Staff

    Yes, absolutely.  Although we do not have an explicit '\ell-1' construct to accommodate the above norm, we have the absolute value helper function, e.g., 

    https://www.gurobi.com/documentation/9.0/refman/py_abs_.html

    that can be used to get the desired expression. Also note that if you aim to simply minimize the L1 norm expression, you may as well build it yourself as a sequence of convex inequalities that involve auxiliary variables, e.g.,

    min ||x||_1

    is equivalent to

    min t

    s.t.

    x_i <= y_i,

    -x_i <= y_i,

    \sum_i y_i == t

    0

Post is closed for comments.