Message Boards Message Boards


Maximize values using a grid search?

Posted 1 year ago
2 Replies
2 Total Likes

enter image description here

I would like to find the maximum value and the optimal ma and md from the above two functions using GRID search. I have tried but it doesn't work. Do you have any ideas? Any different example of the function with the code would also be great.

f = Integrate[PDF[NormalDistribution[10*Subscript[m, d], 1*Subscript[m, d]], Subscript[c,i]] * (Subscript[m, d]*Subscript[c, i] - 10) * (1-CDF[NormalDistribution[10*Subscript[m, a], 2*Subscript[m, a]], Subscript[c, i]]), {Subscript[c, i], -Infinity, Infinity}]; 
g = Integrate[PDF[NormalDistribution[10*Subscript[m, a], 2*Subscript[m, a]], Subscript[c,i]] * (Subscript[m, a]*Subscript[c, i] - 10) * (1-CDF[NormalDistribution[10*Subscript[m, d], 1*Subscript[m, a]], Subscript[c, i]]), {Subscript[c, i], -Infinity, Infinity}];

NMaximize[f, {Subscript[m, d], Subscript[m, a]},Method -> {"RandomSearch"}];
NMaximize[g, {Subscript[m, d], Subscript[m, a]},Method -> {"RandomSearch"}];

The results show just f and g. It doesn't work for NMaximize. The screenshot is as follows:

enter image description here

2 Replies
Posted 1 year ago

how to start a discussion question as I am new to this blog? thank u Sam

In[21]:= f[md_?NumericQ, ma_?NumericQ] := 
  PDF[NormalDistribution[10*md, md], 
    c]*(md*c - 10)*(1 - 
     CDF[NormalDistribution[10*ma, 2*ma], c]), {c, -Infinity, 

In[22]:= f[1, 1]

Out[22]= -0.178412

In[23]:= NMaximize[{f[md, ma], md >= 0, ma >= 0}, {md, ma}]

During evaluation of In[23]:= General::stop: Further output of NIntegrate::slwcon will be suppressed during this calculation.

During evaluation of In[23]:= NMaximize::cvdiv: Failed to converge to a solution. The function may be unbounded.

Out[23]= {1.80565*10^18, {md -> 3.23597*10^8, ma -> 5.35716*10^11}}
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract