Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Optimization problem Date: Sun, 12 Apr 2009 20:30:04 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 30 Message-ID: <grtj0c$hpc$1@fred.mathworks.com> References: <grrdtl$b6f$1@fred.mathworks.com> <grrp03$6m3$1@fred.mathworks.com> <grtdv1$ou$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-02-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1239568204 18220 172.30.248.37 (12 Apr 2009 20:30:04 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 12 Apr 2009 20:30:04 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:532190 "lovish " <lovishagarwal@gmail.com> wrote in message <grtdv1$ou$1@fred.mathworks.com>... > I apologize for the same. Being new to the community I wasn't aware of this fact of continuing with the old post. > > Secondly for using simple calculus method in this problem, Please guide me as to how you used simple calculus to find maxf(x). > > Other than that,this is just a sample of a extremely complex problem which I;m working on and I wonder whether calculus can work for equations which involves 20 variables. If it can work , please let me know the methodology that you are using. > > I apologize once again for the inconvenience caused to you and other members. I have to apologize that without reading your this post,I posted another questions which has the same flavor as a new thread. I sincerely apologize for that too. I will take care of such things in future. As to the use of simple calculus in your original problem, the reasoning goes this way. Presumably you wish to restrict x1, x2, and x3 to positive values to avoid complex results for the logarithm function. That, along with the further restrictions x1+x2<=1 and x1+x3<=1, limits you to a bounded tetrahedral region in the x1, x2, x3 space. Also f(x1,x2,x3) = log(x1)+log(x2)+log(x3) = log(x1*x2*x3), and since the logarithm is monotonically increasing, we have max(f(x1,x2,x3)) = log(max(x1*x2*x3)) If you take a cross section of this region orthogonal to the x1 axis with the value x1 = x, it would be a square with its four corners at: (x,0,0), (x,1-x,0), (x,0,1-x), and (x,1-x,1-x) The product x1*x2*x3 will be increasing as x2 and x3 increase in the square, so the maximum value within the square will occur at the corner (x,1-x,1-x). This shows that the maximum in the region will occur somewhere along the line segment connecting (0,1,1) and (1,0,0). This is a problem in calculus: find the maximum value of g(x) = x*(1-x)*(1-x) = x^3-2*x^2+x for 0<=x<=1. Taking the derivative gives g'(x) = 3*x^2-4*x+1 = (1-x)*(1-3*x) which is zero at x = 1 and x = 1/3. Clearly the maximum of g(x) is at x=1/3 where g(1/3) = 1/3*(1-1/3)*(1-1/3) = 4/27. This gives the answer of max(f(x1,x2,x3)) = log(4/27). For the "extremely complex problem ... which involves 20 variables" I agree that it is doubtful that you could use such simple methods to solve it. So you will probably have to follow John D'Errico's advice and use 'fmincon' of the Optimization Toolbox. You should be forewarned that with as many as 20 variables this function can encounter great difficulties. For it to explore even such a simple thing as every possible combination of two discrete values of each of the twenty variables takes over a million evaluations! You may find it expedient to effectively eliminate many of your twenty variables in some clever manner. Roger Stafford