# Implementation of nonlinear optimization for Generalized Nash-Equilibrium

I have to find a solver for $$$$\min_{x^{\nu}} \Theta_{\nu}(x^{\nu},x^{-\nu})$$$$ with $$x^{\nu} \in X_{\nu}$$ which is a convex set.

$$x^{*}$$ needs to satisfy $$\nabla_{x^{\nu}} \Theta_{\nu}(x^{k+1,1},...,x^{k+1,\nu-1},x^{k+1,\nu},x^{k,\nu+1},...,x^{k,N})^{T}(x^{\nu}-x^{k+1,\nu})\geq 0 ~ \forall x^{\nu}\in X_{\nu}$$ in order to fulfill the necessary condition for a nash equilibirum.

I tried to implement such a problem for a oligopoly example (see below) using Jacobi Diagonalization Method. Also, I´m working with a german book (reference also below) using matlab. The problem is: I have almost no experience using matlab so at some point I contacted one of the books authors and he kindly sent me a matlab code for the jacobi diagonalization method (only for the ologopoly example) but so far I have not been able to figure out his code or to figure out where I have to put in the necessary information for the code to work (parameters, constants, functions, etc.).

Example: $$\nu$$ should solve $$\min_{x^{\nu}} \Theta_{\nu}(x)$$ $$x_{\nu} \geq 0$$ using the function $$\Theta_{\nu}(x):= c_{\nu}(x_{\nu})-x_{\nu}p(x_{\nu+ \sum_{\mu \neq \nu }x_{\mu}})$$ with the cost function defined as $$c_{\nu}(x_{\nu}):=c_{\nu}x_{\nu}+\frac{\beta_{\nu}}{1+\beta_{\nu}}L_{\nu}^{-\frac{1}{\beta_{\nu}}}x_{\nu}^{\frac{1+\beta_{\nu}}{\beta_{\nu}}}$$ and the inverse demand function $$p(\xi):=(\frac{\alpha}{\xi})^{\frac{1}{\gamma}}$$

For this case: $$N=5$$, $$\alpha:=5000$$, $$\gamma:=1.1$$, $$\nu:=(1,...,5)^{T}$$, $$c_{\nu}:=(10,8,6,4,2)^{T}$$, $$\beta_{\nu}:=(1.2,1.1,1.0,0.9,0.8)^{T}$$, $$L_{\nu}:=(5,...,5)^{T}$$ using a starting vector of $$x^{0}:=(10,...,10)^{T}$$ and $$\|x^{k+1}-x^{k}\| \leq \epsilon$$ using $$\epsilon:=10^{-5}$$

Reference: Kanzow, Schwartz (2018): Spieltheorie. Theorie und Verfahren zur Lösung von Nash- und verallgemeinerten Nash-Gleichgewichtsproblemen.

I can also send you the matlab code with what I have so far. Its basically just the main programm using the fmincon in the diagonalization loop and I don´t know how to handle it. This is my main problem.