Prev: can't delete the whole column including NaN and nomovement data return column
Next: PTB 'DrawText' over several lines
From: Martin on 2 Mar 2010 10:01 Hi, I try running fmincon on a problem I have. I want to optimize the vector u contianing about 150 variables. I have specified a cost function (cost(u)) and a function returning my nonlinear constraints(constraints(u)). I run it like this: u=fmincon(@cost,U0,[],[],[],[],[],[],@constraints,options); When I run the program the vector u is not updated at all. The same goes for the cost. I have run the program for a few hundred iterations and still nothing happens(every iteration ~1 second). COST= 2.148073832133941e+003 COST = 2.148073832193384e+003 COST = 2.148073832193996e+003 COST = 2.148073832194606e+003 and so on.... As you can see only very small changes are made in the 11th decimal. One wierd thing is that the vector u does not change AT ALL but still the cost changes a tiny little bit. Why doesn't it converge or even make an update of the vector u? Thankful for all help I can get /Martin
From: Matt J on 2 Mar 2010 10:50 "Martin " <martinev(a)kth.se> wrote in message <hmj97h$gq9$1(a)fred.mathworks.com>... > > Why doesn't it converge or even make an update of the vector u? ====== Perhaps U0 is already almost-optimal, or your cost function is very flat in the neighborhood of U0. There's not much more that can be speculated based on the info we have so far.
From: James Allison on 2 Mar 2010 11:57 Yes, it is hard to provide much guidance without more information about your cost and constraint functions. In addition to Matt's suggestions, you may want to ensure that the optimization variables and objective and constraint functions are scaled appropriately. This may be a numerically ill-conditioned problem. Some problems require even nonlinear scaling to be solvable. You might also want to couple fmincon with a global search algorithm to get a good starting point (latin hypercube, genetic algorithm, etc.). -James Martin wrote: > Hi, > I try running fmincon on a problem I have. I want to optimize the vector > u contianing about 150 variables. I have specified a cost function > (cost(u)) and a function returning my nonlinear > constraints(constraints(u)). > > I run it like this: > > u=fmincon(@cost,U0,[],[],[],[],[],[],@constraints,options); > > When I run the program the vector u is not updated at all. The same goes > for the cost. I have run the program for a few hundred iterations and > still nothing happens(every iteration ~1 second). > > COST= > > 2.148073832133941e+003 > > > COST = > > 2.148073832193384e+003 > > > COST = > > 2.148073832193996e+003 > > > COST = > > 2.148073832194606e+003 > and so on.... > As you can see only very small changes are made in the 11th decimal. One > wierd thing is that the vector u does not change AT ALL but still the > cost changes a tiny little bit. > > Why doesn't it converge or even make an update of the vector u? > > Thankful for all help I can get > /Martin
From: Martin on 2 Mar 2010 15:38 James Allison <james.allison(a)mathworks.com> wrote in message <hmjg1c$knn$1(a)fred.mathworks.com>... > Yes, it is hard to provide much guidance without more information about > your cost and constraint functions. In addition to Matt's suggestions, > you may want to ensure that the optimization variables and objective and > constraint functions are scaled appropriately. This may be a numerically > ill-conditioned problem. Some problems require even nonlinear scaling > to be solvable. You might also want to couple fmincon with a global > search algorithm to get a good starting point (latin hypercube, genetic > algorithm, etc.). > > -James > Thank you very much, both of you guys! Yes U0 is probably fairly close to optmimal already but I have tried som random vectors aswell and I still dont get any good results=( "Scaled correctly" - What does this mean, and how do I fix it? Ill look in to global search algoritms aswell! thank you!
From: Matt J on 2 Mar 2010 16:16
"Martin " <martinev(a)kth.se> wrote in message <hmjsva$ro3$1(a)fred.mathworks.com>... > "Scaled correctly" - What does this mean, and how do I fix it? ====================== For example, this function f(x,y)=100000000*x^2 +y^2 is poorly scaled because the value of the function is much more sensitive to changes in x than to y. There are a variety of challenges this creates for minimizing f(x,y). For example, if you run steepest descent on this function, it can take many many iterations to reach the minimum x=y=0. The way this problem should have been posed is to introduce the variable z=10000*x, which basically is the same as x but measured in much smaller units. Then we could write the objective function as f(z,y)=z^2+y^2 which is much better scaled,i.e. f() is comparably sensitive to all the variables. Steepest descent will minimize f(z,y) in 1 iteration with exact line search. |