# Perfect competition as example

In the last step we took a dive into the underlying mathematics of our models. To get a better understanding of what this means for your model design, we now use our simple energy system logic to design an optimization model and an equilibrium model that will result in the same outcomes.

The setup is the same for both. We assume a perfectly competitive market in which producers aim to maximize their short run profit given their cost function. Consumers aim to maximize their benefit derived from consuming electricity.

In an optimization setting, you know that you need to combine the individual objectives (firm’s profits and consumer benefit) into a single objective, \(B(d)\). As we assume perfect competition, this is easily doable by maximizing the welfare in our system (as discussed in an earlier step). Consequently, the objective function for the social planner looks like this:

(1) \(\max\limits_{q_i,d\geq 0} \enspace B(d)-\sum\limits_{i}{c_i(q_i)}\)

\(B(d)\) represents the benefit function of consumers (how much utility they derive from their demand \(d\)) and the profits from the firm. \(c_i(q_i)\) represents the generation costs of firm \(i\).

As side constraints you will again need to ensure that total supply is sufficient to cover demand. Clearly, demand cannot be less than 0:

(2) \(\sum\limits_{i}{q_i} =d\)

If you would derive the Karush–Kuhn–Tucker (KKT) conditions of the Lagrangian formulation of these two equations you would obtain the optimality conditions defining which level of supply and demand maximizes welfare. Let’s just focus on the two decision variables: \(q_i\). Again, you will need to derive the first order condition of the model with respect to the two variables and set them equal to zero:

(3) \(\frac{∂B}{∂d}-μ=0\)

(4) \(\frac{∂c_i(q_i)}{∂q_i}+μ=0\)

The \(µ\) is again the Lagrangian multipliers on the side constraint.

Equations (4) and (5) together with the side constraint (2) tell you the optimality criteria for your model.

Ok, let’s shortly switch to the equilibrium world and design the same problem in an equilibrium setting. Here we have firms maximizing profits, consumers maximizing their benefit, and a market that brings the two sides together.

You know that firms will only produce if the marginal costs are covered. Using this zero-profit logic you can write their equilibrium conditions as follows:

(5) \(\frac{∂c_i(q_i)}{∂q_i}\geq p \bot q_i\geq0\)

This formulation is the mathematical equivalent of our equilibrium logic. Either the firm has a positive output (\(q_i > 0\)) in which case the left hand side of equation (5) needs to hold with equality (\(\frac{∂c_i(q_i)}{∂q_i}=p\)); or the firm does not produce (\(q_i = 0\)) in which case the left hand side is in inequality (\(\frac{∂c_i(q_i)}{∂q_i}>p\)). The perpendicular sign \(\bot\) allows us to write this combination a bit more compactly.

The same logic holds for the consumer side:

(6) \(p \geq \frac{∂B}{∂d} \bot d \geq 0\)

Consumers will only consume energy if the marginal benefit they can derive (\(\frac{∂B}{∂d}\)) is at least as large as the price they have to pay for it.

Now all you need is the market clearing condition to finalize your equilibrium model:

(7) \(\sum\limits_{i}{q_i}\geq d \bot p \geq 0\)

Similar to the zero-profit equations this formulation is the mathematical way of describing the market clearing logic: if we have a positive market price (\(p > 0\)) it means the supply and demand side are in balance (\(\sum\limits_{i}{q_i}=d\)). If we have oversupply (\(\sum\limits_{i}{q_i}>d\)) the market price is zero (\(p = 0\)).

Now if you compare equation (5) to (7) of the equilibrium model with equation (2) to (4) of the optimization model you may see some similarities:

Equation (3) tells us that in the optimum, the marginal benefit of consumers is equal to \(µ\). The same holds for the marginal costs of each firm in the optimum (equation (4)). And this \(µ\) is linked to the constraint that in the equilibrium total supply and demand have to be balanced.

Now this is basically the same story you designed with the equilibrium model. If supply and demand are equal, equation (7) tells us that the resulting market price, \(p\), will be positive. And if you neglect the non-trivial equilibrium of having zero \(d\) and and production (which are balanced by definition) this also means positive production and demand levels. Equation (5) and (6) tell you that in this case the marginal costs of the firms have to be equal to the market price and the marginal benefit of consumers also has to be equal to the market price.

If you now replace the symbol for the market price, \(p\), with some Greek letter, say \(µ\), you see that those are basically the same results. The only difference is that the equilibrium model is formulated in a more general sense (those are conditions that need to hold for the market to be in equilibrium) whereas the optimization equations show the conditions that need to hold for the market to be in the equilibrium that optimizes welfare.

This relation between the two model approaches means two things with respect to analyzing your problem:

First, you are often free to choose one or the other type of model. As long as you can derive a single objective for an optimization you can also formulate an equivalent equilibrium version of your model.

Second, the equilibrium logic of who is doing what (activity) when (zero-profit) and how market prices are related to supply and demand (market clearing) also holds when analyzing your optimization model results. The underlying economic logic is the driving force of the two models. So, a solid understanding of incentives and market dynamics will help you to design, solve, and interpret your models, regardless of what specific model setup you have chosen.

© University of Basel