I'd like to numerically solve a sequential Cournot competition in which supplier 1 moves before supplier 2, then the manufacturer sources from them, and finally sells the item at market clearing price. I know how to solve it analytically, but I would like to learn how I can use Mathematica for such problems. (So please assume that the last step of the backward induction cannot be solved analytically, that is, the optimal quantities.)
Technically, I want to solve:
Given production costs $c_1=1$, $c_2=2$ and market size $A=10$, while wholesale price $w_1$ and $w_2$ are set by suppliers and quantities $q_1$ and $q_2$ are set by the manufacturer.
$\underset{w_1 \geq 0}{\max} q_1 (w_1-c_1)$.
given
$\underset{w_2 \geq 0}{\max} q_2 (w_2-c_2)$
given
$\underset{q_1\geq 0 , q_2 \geq 0}{\max} (A - q_1 - q_2) (q_1+q_2) - q_1 w_1 -q_2 w_2$
It would be great, if you could show me how this one works, because then I can hopefully transfer it to more complex problems.
PS: I am aware of the functions Maximize, Findmaxvalue. My problem is nesting these things and most likely defining on variable as the input of another function.
Profit functions to start working with
Clear["Global`*"]
(*Quantity *)
p[A_, q1_, q2_] := A - q1 - q2
Mprofit[A_, q1_, q2_, w1_, w2_] :=
p[A, q1, q2] (q1 + q2) - w1 q1 - w2 q2
Sprofit[q_, w_, c_] := q (w - c)
LinearProgramming
problem, maybe? $\endgroup$NMaximize
$\endgroup$