Path: news.mathworks.com!not-for-mail From: "lovish " <lovishagarwal@gmail.com> Newsgroups: comp.soft-sys.matlab Subject: Re: problem regarding maximizing a function Date: Mon, 13 Apr 2009 12:36:01 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 19 Message-ID: <grvbjh$1s3$1@fred.mathworks.com> References: <grtdnj$fr7$1@fred.mathworks.com> <grtmvp$rmo$1@fred.mathworks.com> Reply-To: "lovish " <lovishagarwal@gmail.com> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1239626161 1923 172.30.248.38 (13 Apr 2009 12:36:01 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Mon, 13 Apr 2009 12:36:01 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1189748 Xref: news.mathworks.com comp.soft-sys.matlab:532300 Thanks for your response. The maximum values I'm getting is log(0.063). I guess there might be some approximations taken in my case. Thanks again for the help. However, the problem is that I need to plot the function value at each iteration and need to show how this function attains the shape of a concave function. This is possible, I guess, only if we iterate it and that can be done only through optimtool or using any iterative method. Correct me , if I'm wrong. Secondly, I'm given this constraint of using optimization tool which brings me back again to my question. The problem is not with regard to solving the question, my problem is with regard to certain functionality of optim user interface which is not working. So I would appreciate if someone could address my problem! "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <grtmvp$rmo$1@fred.mathworks.com>... > "lovish " <lovishagarwal@gmail.com> wrote in message <grtdnj$fr7$1@fred.mathworks.com>... > > ....... > > I have a problem with regard to maximizing a function. I'm using optimization tool and using fmincon command in that. > > > > Suppose I have to optimize f(x)= log [x(1)+ x(6)] + log x(2) + log x(3) + log x(4) + log x(5) > > subject to x1<=1, x2+x3+x5<=1. x1+x5<=1 , x4<=1; x6<=1 > > > > all values are greater than 0. > > ....... > > The problem you pose here is an example of what I referred to in the "Optimization problem" thread when I said "eliminate many of your ... variables in some clever manner". The variables x4 and x6 appear in your restrictions just once each in x4<=1 and x6<=1. Clearly the maximum occurs with x4=1 and x6=1 and these variables can immediately be eliminated. Similarly x2 and x3 appear only once in x2+x3+x5<=1. The maximum of x2*x3 for a given sum, x2+x3, will occur when x2=x3, so we can replace x3 by x2 everywhere. Now you are down to three variables and again it can easily be solved by calculus. It would pay you to make use of such opportunities with your twenty-variable problem before you subject it to the tender mercies of the Optimization Toolbox. > > By the way, if you allow x1 to sink as low as x1 = -1/2, (which it can without encountering complex logarithms) I get a maximum value of: log(27/64) for your function, just using simple calculus. > > Roger Stafford