# Two sides of the same coin

In the previous step you have learned that the choice of your model design will largely depend on your underlying problem, but also that some model approaches are exchangeable and lead to the same results.

This is particularly important for optimization or equilibrium formulations. The model choice is often a matter of preference in model design and the underlying economic thinking than a strict necessity. In this step, you will see that there is also a mathematical reasoning behind the fact that most problems can be formulated as both model types.

In general, each optimization problem can be transformed into an equilibrium formulation. Remember, how in the examples of equilibria one was the ‘result of an optimization’? This relation is based on the so called **Karush–Kuhn–Tucker (KKT) conditions**.

Let’s take a generic optimization problem as an example:

\(\min \limits_X \enspace {f(X)}\)

s.t. \(g_i(X)=0\)

\(h_i(X) \le 0\)

we can derive the solution by setting up the **Lagrange function** of this problem (by introducing the Lagrangian multiplier \(µ\) for the equality constraints and \(λ\) for the inequality constraints)

and obtain the necessary KKT conditions for a minimum (or first-order condition) by taking the partial derivative of the Lagrangian with respect to X and setting the equation equal to zero:

(1) \(\frac{\partial f(X)}{\partial X}+\sum\mu_i\frac{\partial g_i(X)}{\partial X}+\sum\lambda_i\frac{\partial h_i(X)}{\partial X}=0\)

(2) \(g_i(X)=0\)

(3) \(h_i(X) \le 0\)

(4) \(λ_i h_i(X)=0\)

(5) \(λ_i \ge 0\)

Equation (1) is the simple optimality criterion that the first-order condition with respect to the decision variables (X) need to equal zero. Equation (2) and (3) are the feasibility constraints imposed by the side constraints. Equation (4) is called the complementary slackness condition and results from inequality constraints. Equation (5) the non-negativity restriction on the multipliers of the inequalities. Technically, these equations state the conditions the system has to fulfil in the optimal equilibrium; this is an equilibrium formulation of the above designed optimization problem. (For more information and derivation of the KKT conditions following the link to additional information below.)

Let’s rephrase the conditions a little bit to obtain the same logic we have learned last week about equilibrium problems. For this we need so called **complementarity conditions**. In general, two variables (note: these are not the same variables from the above equations) are complementary to each other if the following holds:

\(X\cdot Y=0; X\geq 0; Y\geq 0\) which is often written as \(X\leq0\perp Y\geq 0\)

This basically tells us that either X or Y needs to be zero.

Returning to the Lagrange formulation of our minimization:

\[L=f(X) + \sum \mu_i g_i (X) + \sum \lambda_i h_i(X)\]we can derive our equilibrium formulation via these **complementarity conditions**, first for the choice variable:

\(\frac{\partial L}{\partial X}X=0;\) \(\frac{\partial L}{\partial X} \leq0;\) \(X\geq0\)

These equations tell us that the product of the first-order condition, \(\frac{\partial L}{\partial X}\), with the respective variable, \(X\), has to equal zero either the variable, \(X\), or the derivative must be zero. This is equivalent to the economic logic introduced for equilibrium models. Either my decision variable X (eg, my output) is positive, in which case the respective first-order condition has to equal zero (my zero-profit condition), or my decision variable is zero (eg, I don’t produce any output because I won’t make a profit or breakeven).

The same holds for the multipliers on the equality and inequality constraints:

\(\frac{\partial L }{ \partial{\mu_i}}\mu_i = 0;\) \(\frac{\partial L}{ \partial{\mu_i}} = 0;\) \(μ_i\) is free

\(\frac{\partial L}{\partial \lambda_i}\lambda_i=0;\) \(\frac{\partial L}{\partial \lambda_i}\leq0;\) \(λ_i \ge 0\)

Either my side constraint is binding (eg, the production capacity limit is reached), in which case my multiplier has a positive value (eg, the shadow price of capacity), or it is not binding and the multiplier has to be zero. Note that for equality constraints the multiplier is free in sign as the enforced equality basically ensures that the derivative has to be zero.

The important point with this reformulation is that it is equivalent to the above formulated KKT conditions which are the solution of the optimization. In other words, if we have an optimization formulation, we can reformulate it as an equilibrium problem and obtain the same result. The reverse is not true, as not all equilibrium models can be transferred into optimization models. Consequently, there are some problems where only equilibrium approaches are feasible. This is the case if more than one actor has to be included in the model design (eg, in case of oligopolistic competition) and we lack a single objective that we can optimize.

Summarizing, each optimization formulation can be transformed into an equilibrium formulation. Therefore, many model designs can be realized via both approaches. In the next step, we will use our energy system example to get a more hands-on understanding of the linkage between optimization and equilibrium.

#### Recommended readings

The literature recommendation below takes up on the combined representation of natural gas and electricity market we already recommended in an earlier step. The model is an extension of the static model formulation presented in Abrell and Weigt (2014) to account for investments. Besides presenting an example of how to design a potential investment decision, the paper also shows the relation between optimization and equilibrium. Within the paper the different market actors are described using their respective profit maximizations and side constraints. This logic is then transferred into an equilibrium formulation in the Annex using the above described relation.

Abrell, J. & Weigt, H. (2014). *Investments in a Combined Energy Network Model: Substitution between Natural Gas And Electricity?* WWZ, University Basel.

© University of Basel