Re: Re: Finding the optimum by repeteadly zooming on the solution space (or something like that)
- To: mathgroup at smc.vnet.net
- Subject: [mg92597] Re: [mg92575] Re: Finding the optimum by repeteadly zooming on the solution space (or something like that)
- From: "Mauricio Esteban Cuak" <cuak2000 at gmail.com>
- Date: Tue, 7 Oct 2008 07:06:30 -0400 (EDT)
- References: <200810060814.EAA28778@smc.vnet.net>
I appreciate both your help! I was trying it the other way because I'm more interested in the speed of the solution than in the precision. Ultimately, what I need to do is to find the optimum "a" for at least thousands of values of r. Say, for a couple of values: Table[NMaximize[{obj, cpoAg1 == 0 && cpoAg2 == 0 && x > 0.1 && y > 0.1}, {a, x, y}], {r, 0.4, 1, 0.2}]] It seems that my approach doesn't improve the speed for most values of r, so I'll try your suggestions. If someone can suggest me a way of speeding things up, I'd really appreciate it. Kind Regards, cd 2008/10/6 Bill Rowe <readnews at sbcglobal.net> > On 10/5/08 at 6:05 AM, cuak2000 at gmail.com (Mauricio Esteban Cuak) > wrote: > > >Hello everyone.I know somebody has probably writ mathematica code on > >this problem. A general answer would probably benefit more people, > >but I'll do the specific example, 'cause I'm not sure how to explain > >it in another way. > > >I have these restrictions: > > >cpoAg1= ( -x + (70*a*(x^0.4 + y^0.4)^0.75)/x^0.6); > > >(*and*) > > >cpoAg2= ((70*(1 - a)*(x^0.4 + y^0.4)^0.75)/y^0.6 - 2*y); > > >(* And I need to find the "a" that will maximise this following > >function. I don't need and exact solution, but something that is > >sufficiently near *) > > >obj = -x^2/2 + 100*(x^0.4 + y^0.4)^1.75 - y^2; > > >(* "A" goes between 0 and 1 so I discretise to obtain the {x,y} that > >maximise every "a" > > >the Table command gives me the list of rules which I can replace on > >"obj" later to find the maximum. No problem here*) > > >rules = Table[ > >FindRoot[{cpoAg1 == 0, cpoAg2 == 0}, {{x, 0.1}, {y, 0.1}}], {a, 0.= > 1, > >1, 0.1} > >]; > > >(*the maximum is found with this following function *) > > >Max[Thread[ReplaceAll[obj, rules]]]; > > >So far so good...I could discretise "a" as thinly as I want, but I > >can't afford the luxury of being that inneficient, 'cause I've got > >to do other things later with this part of the program. > > I don't understand why you would take this approach. Why not use > the built-in function NMaximize, That is: > > In[20]:= NMaximize[{obj, > cpoAg1 == 0 && cpoAg2 == 0 && x > 0.1 && y > 0.1}, {a, x, y}] > > Out[20]= {2084.72,{a->0.527688,x->22.6727,y->13.7173}} > > -- Por favor eviten enviarme archivos adjuntos de Word o Powerpoint ( http://www.gnu.org/philosophy/no-word-attachments.es.html )
- References:
- Re: Finding the optimum by repeteadly zooming on the solution space (or something like that)
- From: Bill Rowe <readnews@sbcglobal.net>
- Re: Finding the optimum by repeteadly zooming on the solution space (or something like that)