Re: Question on two-stage optimization of polynomials:
- To: mathgroup at smc.vnet.net
- Subject: [mg122815] Re: [mg122792] Question on two-stage optimization of polynomials:
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 11 Nov 2011 04:55:26 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201111101155.GAA25392@smc.vnet.net>
On 11/10/2011 05:55 AM, lao kn wrote: > I need to solve an optimization problem. Please offer your insights. > Suppose there are two functions (my case is more complicated than this > example). > > f(x,y)=x-y, 0<x<1, 0<y<1 > g(x,y)=x*y, 0<x<1, 0<y<1 > > The goal is to get the maximum values for f(x,y) and g(x,y). However, > it is not simultaneous, but sequential. In the first stage, only x can > be chosen to maximize f(x,y); in the second stage only y can be chosen > to maximize g(x,y). > > To solve this problem, I should start from the second stage, say, let > x varies from 0 to 1, and get each y that maximizes g(x,y). or in > another word, derive the best response function y*=v(x). Then I can > put the response function back to f(x,y) and solve for the x that > maximizes f(x,y). > > An easy way is to get the reponse function is to differentiate g(x,y) > respect to y, and the set it to zero: df/dy=0, and the response > function is at hand. However, my case is too complex to get the > differentiation. Therefore I need to solve the problem numerically. > > Therefore, what I want is a function or a curve that can let x varies > from 0 to 1 and see the best response value of y. Even if I can not > get a response function, I hope I can get a response curve drawn by > Mathematica. > > Can someone help me out this trouble? > > Many thanks Possibly something like the code below will do what you want. We regard g as a function of one variable, y. We use f to solve for x as a function of y. Clear[f, g, y, x] f[x_, y_] := x + y g[y_] := x[y]*y; x[y_?NumericQ] := Module[{xx}, xx /. Last[NMaximize[{f[xx, y], 0 <= xx <= 1}, xx]]] In[172]:= NMaximize[{g[y], 0 <= y <= 1}, y] Out[172]= {1., {y -> 1.}} Daniel Lichtblau Wolfram Research
- References:
- Question on two-stage optimization of polynomials: how to draw a response function?
- From: lao kn <laoknn@gmail.com>
- Question on two-stage optimization of polynomials: how to draw a response function?