constrained optimization: question about Jacobian
I want to perform constrained optimization of the function def F(X, data): # x1, x2, x3, t2 are scalars, data is a constant np.array x1, x2, x3, t2 = X T = np.arange(X.size) t1, t3 = T[0], T[-1] Xbefore = x1 + (T - t1) * (x2 - x1) / (t2 - t1) Xafter = x2 + (T - t2) * (x3 - x2) / (t3 - t2) Xbreak = np.where(T <= t2, Xbefore, Xafter) return ((Xbreak - data)**2).sum() where the parameter value t2 must be within 0 <= t2 < data.size. According to the tutorial (http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html#constrained...), I need to define the Jacobian. However, I'm unsure of how to define the derivative with regards to t2. Any ideas are greatly appreciated :) Cheers, A.
Andreas Hilboll a écrit :
According to the tutorial (http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html#constrained...), I need to define the Jacobian. However, I'm unsure of how to define the derivative with regards to t2.
The Jacobian is optional for most if not all solvers, so you don't *need* to provide it.
According to the tutorial (http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html#constrained...), I need to define the Jacobian. However, I'm unsure of how to define the derivative with regards to t2.
The Jacobian is optional for most if not all solvers, so you don't *need* to provide it.
Merci, Denis, I wasn't aware of that. Just followed the tutorial.[*] Now everything's working fine. Cheers, Andreas. [*] I just submitted a PR to mention this: https://github.com/scipy/scipy/pull/481
participants (2)
-
Andreas Hilboll -
Denis Laxalde