MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayNew to MATLAB?
MATLAB Central > MATLAB Newsreader > speeding up constrained optimization 

Subject: speeding up constrained optimization From: Sargondjani Date: 28 Mar, 2012 06:17:12 Message: 1 of 21 
hi, 
Subject: speeding up constrained optimization From: Bruno Luong Date: 28 Mar, 2012 07:20:17 Message: 2 of 21 
"Sargondjani" wrote in message <jkuad8$6t4$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Sargondjani Date: 28 Mar, 2012 09:17:13 Message: 3 of 21 
datapoints (ix) in grid: X(1:n) 
Subject: speeding up constrained optimization From: Matt J Date: 28 Mar, 2012 13:09:18 Message: 4 of 21 
"Sargondjani" wrote in message <jkukup$6uf$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Matt J Date: 28 Mar, 2012 13:15:25 Message: 5 of 21 
"Matt J" wrote in message <jkv2hu$i30$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Sargondjani Date: 28 Mar, 2012 15:00:29 Message: 6 of 21 
> First problem. Your function is not differentiable if INTERP1 is using its default linear interpolation. Since FMINCON only handles differentiable problems, you should consider using the 'spline' option instead. 
Subject: speeding up constrained optimization From: Matt J Date: 28 Mar, 2012 15:22:18 Message: 7 of 21 
"Sargondjani" wrote in message <jkukup$6uf$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Sargondjani Date: 28 Mar, 2012 15:39:21 Message: 8 of 21 
More thorough description is as follows (with adjusted notation): 
Subject: speeding up constrained optimization From: Sargondjani Date: 28 Mar, 2012 15:40:30 Message: 9 of 21 
> One more general point. If the solutions will not change greatly with each increment of your triple loop, you should take advantage of that: Use the solution obtained for the previous it,iz,ix triplet to initialize FMINCON for the next triplet. This will cut down the number of iterations that FMINCON must perform. 
Subject: speeding up constrained optimization From: Matt J Date: 28 Mar, 2012 18:22:12 Message: 10 of 21 
"Sargondjani" wrote in message <jkvbde$lqs$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Matt J Date: 28 Mar, 2012 18:37:12 Message: 11 of 21 
"Sargondjani" wrote in message <jkvbb9$led$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Matt J Date: 28 Mar, 2012 18:42:12 Message: 12 of 21 
"Matt J" wrote in message <jkvloo$11e$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Sargondjani Date: 28 Mar, 2012 21:56:12 Message: 13 of 21 
I didnt even see i could use an analytical solution... anyway, i would still prefer to get E(K) using numerical approximation, because i might change the shape of p(E) later on (i would prefer p'(0)=+inf) 
Subject: speeding up constrained optimization From: Sargondjani Date: 28 Mar, 2012 22:29:11 Message: 14 of 21 
> As for the optimization with 'fminbnd': I want to include the lower boundary for K because I know that will be optimal in some cases. You dont think 'lsqnonlin' is a good idea??? 
Subject: speeding up constrained optimization From: Matt J Date: 29 Mar, 2012 14:11:17 Message: 15 of 21 
"Sargondjani" wrote in message <jl01ds$b42$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Sargondjani Date: 29 Mar, 2012 20:27:22 Message: 16 of 21 
> To me, it seems like overkill to be using lsqnonlin to minimize a 1D function, and I would expect it to be slower as well. With a 1D function, there are only 2 choices for the optimal direction of descent (left or right) and you only need to compute the gradient to find it. FMINBND is smart enough to know this. Conversely, lsqnonlin has ndimensional functions in mind, and so it tries to compute both gradients and Hessians (or other related quantities, depending on the algorithm used), in order to find the best path of descent. I guess there's no harm, though, in trying both ways and comparing. 
Subject: speeding up constrained optimization From: Matt J Date: 29 Mar, 2012 20:44:12 Message: 17 of 21 
"Sargondjani" wrote in message <jl2gja$i3g$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Sargondjani Date: 30 Mar, 2012 09:47:19 Message: 18 of 21 
"Matt J" wrote in message <jl2his$le2$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Matt J Date: 30 Mar, 2012 17:56:12 Message: 19 of 21 
"Sargondjani" wrote in message <jl3vf7$nbm$1@newscl01ah.mathworks.com>... 
Subject: speeding up constrained optimization From: Sargondjani Date: 31 Mar, 2012 09:29:12 Message: 20 of 21 
If you know an example where fminbnd would be faster, i would like to know :) 
Subject: speeding up constrained optimization From: Matt J Date: 31 Mar, 2012 18:32:12 Message: 21 of 21 
"Sargondjani" wrote in message <jl6ip8$lu9$1@newscl01ah.mathworks.com>... 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.