Answered Optimization Package Error / Bug

  • Wednesday, August 22, 2012 10:36 PM
     
      Has Code

    I am using the ShoNS Optimizer, running code such as:

    QN = new QuasiNewton();
    QN.MaxIterations = 250;
    QN.Tolerance = 1e-6;
    results = QN.MinimizeDetail(new DiffFunc(GetDerivatives), new double[] {curA,curR});
               

    Sometimes it works great, other times, it gives the solution quality as "UserCalculationError" and gives a solution that is not as optimal as one it previously visited (though usually within 2% of the optimal.

    I have numerically checked my derivative function so know it is okay, and the optimizer appears to get to have all the gradients be equal to 0+epsilon, that is the right solution, before it throws this error and gives the wrong solution.  Does anyone know what this error means or what triggers it?

    Any help much appreciated.


    • Edited by Timers1234 Wednesday, August 22, 2012 10:36 PM
    •  

All Replies

  • Thursday, August 23, 2012 2:34 AM
     
     
    Just an update, tried some stabilizing transforms, nothing worked, the algorithm keeps getting close and then taking a ludicrously large step away from the solution, not sure why.
  • Saturday, August 25, 2012 6:03 PM
     
     Answered

    Well, had to give up on it.  The optimization package seems to work much better if you pre-condition the variables so they are exactly of the same magnitude and you have a good gues, but the ones I was working with were not that different in scale, so I was surprised this was necessary and the thing wasn't robust enough to see this.  

    But, to whoever else has this problem, I think the User Calculation Error is related to the hessian not being well estimated due to numeric difficulties.  Another good alternative is AlgLib http://www.alglib.net/, seems to agree more with the matlab solvers based on my tests.

    • Marked As Answer by Timers1234 Saturday, August 25, 2012 6:03 PM
    •