メインコンテンツへスキップ

Objective Q not PSD (diagonal adjustment of 1.8e-06 would be required)

回答済み

コメント

1件のコメント

  • Jaromił Najman
    • Gurobi Staff

    Hi Jacob,

    But when I run my code, it shows that:

    GurobiError: Objective Q not PSD (diagonal adjustment of 1.8e-06 would be required)

    Gurobi, determines numerically whether a matrix is PSD. Thus, it is prone to numerical errors during the computation. It may happen that sometimes PSD matrices are not recognized as such due to accumulation of numerical inaccuracies during the computation process.

    The Q in my objective is something like C^TC, a psd matrix. And I also test it, the minimal eigenvalue is -1.6099811703270051e-12+0j. 

    This means that your Q matrix is very slightly not PSD. This is often caused by inaccurate data, e.g., when some digits where truncated or some rounding errors were performed during data computation.

    I see two possible solutions to this issue.

    1. The easy one. You can increase the value of the PSDTol parameter to make sure Gurobi recognizes your model as convex. According to the Error you see, an adjustment of 1.8e-6 is necessary which is only slightly above the default PSDTol value. So setting PSDTol=1e-5 should be enough for this particular model. Please note that setting the PSDTol value can work for this particular model but once you change the data set slightly, new numerical inaccuracies might come up and you would have to adjust the value again. Thus, this is not the best long term solution.

    2. The difficult one, which would probably help your overall application longterm. You could take a closer look at the data you use to construct the Q matrix. You could check whether some numerical inaccuracies might sum up and whether the data values have enough digits. One could call this process "checking wether you have clean data". You can always reiterate your "minimal eigenvalue test" to make sure that the matrix is truly PSD.

    Best regards, 
    Jaromił

    0

サインインしてコメントを残してください。