In the following script:
import numpy as np
from scipy.optimize import minimise
a=np.array(range(4))
b=np.array(range(4,8))
def sm(x,a,b):
sm=np.zeros(1)
a=a*np.exp(x)
sm += sum(b-a)
return sm
x0=np.zeros(4)
print sm(x0,a,b) #checking my function
opt = minimize(sm,x0,args=(a,b),method='nelder-mead',
options={'xtol': 1e-8, 'disp': True})
I am trying to optimise for x but I am having the following message:
Warning: Maximum number of function evaluations has been exceeded.
And the result is:
array([-524.92769674, 276.6657959 , 185.98604937, 729.5822923 ])
Which is not the optimal. My question is am I having this message and result because my starting points are not correct?