[SciPy-User] scipy.optimize.minimize changes values at low decimal place

jan-hendrik.berlin jan-hendrik.berlin at cs.uni-dortmund.de
Sun Jul 22 21:09:45 EDT 2018


Hey guys,

this is my code for the optimisation.

       initialGuess = D.Matrix[:,D.menge]
       bnds = D.Matrix[:,(D.mengenMin,D.mengenMax)]
       con1 = {'type': 'eq', 'fun': PercentSum}
       con2 = {'type': 'eq', 'fun': MinMaxProportion}
       cons = ([con1,con2])

       solution = minimize(rootfunc,initialGuess,method='SLSQP',\
                     bounds=bnds,constraints=cons)

The Problem is, the algorithm changes values at low decimal place.
e.g. this is my initial guess. I already tried to change from float to 
integers, to have a work around.

      [  0.   0. 123.   0.   0. 622. 245.   0.   0.   0.]

The first try of the of the optimizer looks like this:

     [1.49011612e-08 0.00000000e+00 1.23000000e+02 0.00000000e+00
     0.00000000e+00 6.22000000e+02 2.45000000e+02 0.00000000e+00
     0.00000000e+00 0.00000000e+00]

Another is this:

     [  0.           0.         123.00000001   0.           0.
      622.         245.           0.           0.           0.        ]

And finally the optimization finishes with this error:

     status 6
     message Singular matrix C in LSQ subproblem

I think the problem is the tiny difference. Is there a possibility to 
tell the SLSQP algorithm only to try changes on the first two decimal 
places or higher?

kind regards

jan


More information about the SciPy-User mailing list