|
Prev: Audio - Auto level Control AGC
Next: fminsearch problem
From: Steven Lord on 17 May 2010 13:14 "MZ AM" <mazamin(a)yahoo.com> wrote in message news:hsrrmo$bd3$1(a)fred.mathworks.com... > Thanks Matt. > > You are right about the way the the constraints should be applied. > Actually I had defined a function that was called as an argument of > fmincon and returned [cineq, ceq]. But because in my case cineq is a > vector itself and ceq=[], I was just showing the cineq in my posting. But > to clear the confusion of why cineq is a vector, I should mention that the > optimization should be performed in a range of data that are pressure (p) > dependent. I would like the optimization use the constraints and read all > from one constraint function file: > > con1 for p<p1 > con2=[ ] for p1<p<p2 > con3 for p>p2 So you have different sets of nonlinear constraints (with different numbers of constraints) depending on where in the parameter space your parameter's current value is located? That seems like a Bad Thing. > So with the above description I will need the cineq to be a vector like: > cineq=[-0.1 -0.2 .....[] [] []......-0.5 0.15] (and of course these []'s > cause problem because they are not double-type data). Also in my case > ceq=[]. No, the problem is not that [] is "not double-type data": x = []; whos x The problem is that you're changing the _number_ of constraints, and that none of the optimization functions can handle directly. Either solve the problem in each region (where p < p1, where p is between p1 and p2, and where p2 < p) separately and choose the best result from the three solutions or keep the length of the cineq vector the same for all the constraint sets by padding it with 0's. > On the other hand, I do not want to use three fmincon functions for the > the three ranges of pressure that I have as it will yield three different > optimized values which is not desired in my problem. > I don't believe a vector constraint can cause a problem, do you? It can if the vector of constarints is not the same size each time. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: Matt J on 17 May 2010 13:43 > Either solve the problem in each region (where p < p1, where p is between p1 > and p2, and where p2 < p) separately and choose the best result from the > three solutions or keep the length of the cineq vector the same for all the > constraint sets by padding it with 0's. ================= Probably best to solve the problem in each region separately. If you try to piece together the 3 different constraints by padding cineq with zeros, the constraints will (potentially) be non-differentiable at the boundaries of the three regions, thereby violating the theory underlying fmincon. > > On the other hand, I do not want to use three fmincon functions for the > > the three ranges of pressure that I have as it will yield three different > > optimized values which is not desired in my problem. Why is that a big deal? Once you have the 3 different solutions, just choose the one with the best objective function value.
From: MZ AM on 19 May 2010 15:58 Thanks Walter, I executed my code with nonlinear inequality set to +inf. However after about 5 hrs it did not converge and I stopped it (the same program with no constraint converges in about 10sec). But if I want to answer your question about the difference between inf and null constraints I would say that in the latter we want to minimize a function F with no constraint, for example F= x^2 - 1 which gives me x=0 for the entire my entire domain. Now if I set a constraint e.g. x>1, the answer will be x_min=1, if I set x>10, x_min will be 10. But what if x>inf? Will be the x_min=inf acceptable? I guess the answer is no. So I believe that the function does not know what the true constraint is in when constraint is inf. Thanks Mazyar Walter Roberson <roberson(a)hushmail.com> wrote in message <NZWGn.7324$h57.2120(a)newsfe22.iad>... > MZ AM wrote: > > > Basically I do not need any constraint under some numerical > > circumstances that's why I use null. If I understood you correctly, the > > use of realmax that you explained may simulate something like infinity > > for my constraint, which is not correct in my case. > > What difference do you perceive between a constraint of infinity and no > constraint at all? Unless you want that parameter to possibly be complex > -- I haven't checked to see if fmincon handles complex parameters?
From: Walter Roberson on 19 May 2010 16:04 MZ AM wrote: > But if I want to answer your > question about the difference between inf and null constraints I would > say that in the latter we want to minimize a function F with no > constraint, for example F= x^2 - 1 which gives me x=0 for the entire my > entire domain. Now if I set a constraint e.g. x>1, the answer will be > x_min=1, if I set x>10, x_min will be 10. But what if x>inf? Will be the > x_min=inf acceptable? I guess the answer is no. So I believe that the > function does not know what the true constraint is in when constraint is > inf. The documentation for fmincon says, "If x(i) is unbounded below, set lb(i) = -Inf, and if x(i) is unbounded above, set ub(i) = Inf." Your argument supposes that the *lower* bound is set to infinity.
From: MZ AM on 19 May 2010 17:50 Thanks Matt. Could you further elaborate the " If you try to piece together the 3 different constraints by padding cineq with zeros..." ? I also agree with you about using 3 different equations. But this is not the way that it used to be done. But probably I will give it a shot. Thanks, MZ "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hsrv79$a6h$1(a)fred.mathworks.com>... > > > Either solve the problem in each region (where p < p1, where p is between p1 > > and p2, and where p2 < p) separately and choose the best result from the > > three solutions or keep the length of the cineq vector the same for all the > > constraint sets by padding it with 0's. > ================= > > Probably best to solve the problem in each region separately. If you try to piece together the 3 different constraints by padding cineq with zeros, the constraints will (potentially) be non-differentiable at the boundaries of the three regions, thereby violating the theory underlying fmincon. > > > > > > On the other hand, I do not want to use three fmincon functions for the > > > the three ranges of pressure that I have as it will yield three different > > > optimized values which is not desired in my problem. > > Why is that a big deal? Once you have the 3 different solutions, just choose the one with the best objective function value.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Audio - Auto level Control AGC Next: fminsearch problem |