I'm solving the following convex optimization problem: $(p^\ast_{L_i},p^\ast_{H_i}, r^\ast)=\text{argmax}_{p_{L_i},p_{H_i}, r} \left\{ r\sum_i \left[ p_{L_i} N^B_{L_i} + p_{H_i} N^B_{H_i} \right ] \right\}$
$\text{subject to} \,\,\, N^S_i = N^{B}_{H_i} + (1+x_i)N^{B}_{L_i} \\ \qquad \qquad \quad \,\, x_i = \frac{p_{H_i}-p_{L_i}}{d} \\ \qquad \qquad \, \, \, \, \, N^B_{L_i} \geq 0 \\ \qquad \qquad \quad \, \, \, \, \, 0 \leq x_i, r \leq 1$
Where $N^B_{L_i}$, $N^B_{H_i}$, $N^S_i$ are defined as follows:
$N^S_i = 1- F^S\left(\frac{N^B_{H_i}(p_{H_i}-r)+ N^B_{L_i}(p_{L_i}-r)}{N^B_{H_i}+(1-x_i)N^B_{L_i}+2 x_i N^B_{L_i}}\right)$
$N^B_{L_i} = F^B\left(\frac{p_{H_i} -p_{L_i}}{x_i}\right) - F^B\left(\frac{s-p_{L_i}}{1+x_i}\right) $
$N^B_{H_i} = 1- F^B\left(\frac{p_{H_i} -p_{L_i}}{x_i}\right)$
So $d$,$s$, and our CDFs $F^B$ and $F^S$ are givens. Everything else is unknown. But I'm not sure how to handle the $x_i$ terms. My understanding of what I am trying to model is that $x_i$ should be pinned down (in expectation) by the prices, ex-post seeing prices. So I can't define $x_i$ unless it's a parameter of the model or an unknown variable (in Python, to solve numerically). Anyone have any experience with the constraint implicitly defining the objective function? This does seem similar to the dual problem in convex optimization, so I think it has to be doable!