Prev: which toolbox
Next: DSP
From: Jan on 20 Mar 2010 05:48 I want to perform parametrized function optimization with constraints using fmincon. I wrote appropriate nested function, that is being optimized, defined constraints and so on. However I run into a problem: optimization stops in the second iteration (Optimization terminated: first-order optimality measure less than options.TolFun and maximum constraint violation is less than options.TolCon.) and no further optimization is performed. I managed to find the reason of this problem, but I don't know how to solve it. The problem is as follows. As a starting point for optimization (x0) I select 1.0. My function is evaluated in this point by fmincon. Then, the second point in which fmincon evaluates the function is 1.000000014901161. However, my function operates on discrete values (images, to be exact) and such a small change in optimized variable's value doesn't lead to any change in optimized function's value, since - at some point - double values are rounded to integers. I made a test: if I remove rounding and let my function operate on doubles instead of integers, then optimization works as it should. How can I solve this problem (removing rounding is not an option in the final version of my algorithm, I've done it only for debugging purposes).
From: Yi Cao on 20 Mar 2010 06:18 Hi Jan, The second evaluation I believe is determined by fmincon in order to calculate the approximated derivatives through the finite difference. Therefore, to avoid the small deviation of x, either you have to provide your own derivatives or you need to rescale your problem so that it can use most of the double range. For example, you can scale your solution range within 0 - 1. HTH Yi "Jan " <fremenzone(a)poczta.onet.pl> wrote in message <ho25kj$66m$1(a)fred.mathworks.com>... > I want to perform parametrized function optimization with constraints using fmincon. I wrote appropriate nested function, that is being optimized, defined constraints and so on. However I run into a problem: optimization stops in the second iteration (Optimization terminated: first-order optimality measure less than options.TolFun and maximum constraint violation is less than options.TolCon.) and no further optimization is performed. I managed to find the reason of this problem, but I don't know how to solve it. > > The problem is as follows. As a starting point for optimization (x0) I select 1.0. My function is evaluated in this point by fmincon. Then, the second point in which fmincon evaluates the function is 1.000000014901161. However, my function operates on discrete values (images, to be exact) and such a small change in optimized variable's value doesn't lead to any change in optimized function's value, since - at some point - double values are rounded to integers. I made a test: if I remove rounding and let my function operate on doubles instead of integers, then optimization works as it should. How can I solve this problem (removing rounding is not an option in the final version of my algorithm, I've done it only for debugging purposes).
From: Bruno Luong on 20 Mar 2010 06:18 "Jan " <fremenzone(a)poczta.onet.pl> wrote in message <ho25kj$66m$1(a)fred.mathworks.com>... >How can I solve this problem (removing rounding is not an option in the final version of my algorithm, I've done it only for debugging purposes). Then FMINCON is a wrong tool for your problem. FMINCON assumes a differentiable cost function. If you have rounding, then you should use other minimizer. Bruno
From: Jan on 20 Mar 2010 07:34 Which minimizer would be the best for such task? Let me clarify, that minimized function returns doubles, not integers, however this doesn't change much since these doubles are calculated based on integers. I'm afraid that scaling of my problem is not possible. "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <ho27cq$1b9$1(a)fred.mathworks.com>... > "Jan " <fremenzone(a)poczta.onet.pl> wrote in message <ho25kj$66m$1(a)fred.mathworks.com>... > >How can I solve this problem (removing rounding is not an option in the final version of my algorithm, I've done it only for debugging purposes). > > Then FMINCON is a wrong tool for your problem. FMINCON assumes a differentiable cost function. If you have rounding, then you should use other minimizer. > > Bruno
From: Bruno Luong on 20 Mar 2010 08:05
"Jan " <fremenzone(a)poczta.onet.pl> wrote in message <ho2brc$510$1(a)fred.mathworks.com>... > Which minimizer would be the best for such task? Probably integer programming, but they are out of my fields of expertise so hope someone who knows better those techniques can guide you. Bruno |