0
$\begingroup$

thanks to Ulrich Neumann I am getting close to the solution of my problem... However, Mathematica tells me that no points satisfy the constraints of the following problem:

 i = 117; A = 1*10^4; a = 10;
f[w_?NumericQ, p_?NumericQ] := (A - a p) (p - w) 
pR[w_?NumericQ] := Block[{p}, NArgMax[{f[w, p], p >= 0, w >= i}, p]]
J[w_?NumericQ] := (A - a pR[w]) (w - i)
NMaximize[{J[w], {w > i, f[w, pR[w]] > 0}}, w, Method -> "NelderMead",
  AccuracyGoal -> 3]

Yet, it is easy to show that $pR[181]=590.5$ and $f[181, 590]>0$, so that $w>i$, $p>=0$ and $f[w, pR[w]] > 0$ are fulfilled.

So where exactly is this code letting me down?

$\endgroup$
1
$\begingroup$

Remove the constraint w>i. NArgMax expects only constraints depending on p!

pR[w_?NumericQ] :=Block[{p}, NArgMax[{f[w, p], p >= 0(*,w\[GreaterEqual]i*)}, p]]

Now the NMaximize evaluates

J[w_?NumericQ] := (A - a pR[w]) (w - i)
NMaximize[{J[w], {w > i, f[w, pR[w]] > 0}}, w,Method ->"NelderMead",AccuracyGoal -> 3, EvaluationMonitor :> Print[{w, J[w]}]]

but probably didn't find a solution...

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.