Group Abstract Group Abstract

Message Boards Message Boards

Optimization

GROUPS:
I have a function f(x,y) with two variables x and y. Now I want to find max{\int_a^b f(x,y)dy} where max is over the variable x. The form of f(x,y) is very complicated and so both the maximization and the integral \int_a^b f(x,y)dy have to be done numerically. But here is a problem. The integral has an unknown variable x. Is there a way this can be done in Mathematica? Any thoughts? Thanks.
POSTED BY: He R
Answer
5 months ago
You could write a function of x that does the optimization for a numerical value of x.  You'll want to define f[x,y] as f[ x_?NumberQ, y _?NumberQ] so the optimiztion function you use will know that it can't be evaluated symbolically.
POSTED BY: Frank Kampas
Answer
5 months ago
Thanks Frank!
My function is
g[c_,s_]=-118093./((3.33333 (2 - 0.3 c)^0.3 (1 - s) +
   3.33333 (1 + 0.7 c)^0.3 s)^3.33333)^3.2

and I have defined

f[c_?NumericQ] =
 NExpectation[g[c,s], s \ TriangularDistribution[{0, 0.5}]]

But my optimization still gives errors:
NMaximize[{f, 0 <= c <=2}, {c}]
POSTED BY: He R
Answer
5 months ago
I don't understand your function definition, so I can't comment on that.  However, I do see that you didn't give the argument to f in NMaximize.  It should be NMaximize[  {f, 0 <= c<=2,{c}]
POSTED BY: Frank Kampas
Answer
5 months ago