Skip to main content

Solving Least Squares yields wrong result

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?.
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Yannic,

    Least squares problems can achieve negative values and even be unbounded.This can be found in, e.g., Boyd's Convex Optimization book (Example 3.9 on page 81).

    In your case, the unboundedness is very likely caused by the numerics of your model (assuming that the problem defined by your \(\texttt{A}\) matrix is indeed bounded). The quadratic ranges are pretty large

    Objective range [3e+01, 3e+04]
    QObjective range [8e-01, 3e+05]

    and the coefficients have a lot of seemingly significant digits, given their rather large order of magnitude.

    You could try reformulating your model as

    \[\begin{align}\min_{z_i,x_i} &\sum w_i \cdot z_i^2 \\
      \text{s.t.  } &z_i = a_i^T x - b_i \quad \forall i \end{align}\]

    which might help in tackling the numerical issues.

    Best regards,
    Jaromił

    0

Post is closed for comments.