Environments

An RL environment is the economic game translated into a learning interface.

The Environment in Reinforcement Learning

In reinforcement learning, the environment is the part of the problem that turns a choice into a consequence. Formally, it is convenient to write it as a Markov decision process with tuple . is the space of states or observations available to the agent. is the action set. maps current states and actions into the distribution of next states. returns the reward. This notation does not replace the economics. It reorganizes it. A firm observes a market signal, chooses a quantity or a price, receives profit, and then faces a market altered by strategic interaction.

The basic loop is short: observation, action, reward, next observation. The difficulty is not the syntax. It is the economic content assigned to each object. In Cournot, the natural action is . In Bertrand, it is . The reward is firm profit, not an auxiliary training signal. The state depends on the information structure. If the firm observes only its own profit, the problem has bandit feedback. If it observes aggregate output or market price, the state contains a public signal about joint behavior. If it also observes rivals’ actions, the learning problem changes again. State design is not a technical footnote. It determines what can be inferred from experience.

flowchart LR
    A[Agent observes state or market signal] --> B[Agent chooses action]
    B --> C[Environment clears the market]
    C --> D[Environment computes profit as reward]
    D --> E[Environment returns next observation]
    E --> A

The transition kernel has an equally concrete interpretation here. In abstract RL examples, transitions often appear as a black box. In repeated oligopoly, the box is the market rule combined with the rivals’ policies. A quantity choice affects total output , the implied price, and the signal observed next period. A price choice affects demand shares, profits, and the future information set. The game is stationary at the level of rules, but not at the level of each firm’s experience. Every agent faces an environment that moves because the other agents are learning too.

That point matters for equilibrium selection. The environment is the mechanism that carries strategic feedback across time. If the observation space is too thin, agents may fail to distinguish punishment from noise. If it is too rich, coordination may become easier. What looks like an implementation detail in ML language is often a substantive assumption in economic language.

Parallelization as Methodology

Parallelization is not a convenience feature. It is part of the empirical design.

This project compares algorithm classes, information structures, market forms, numbers of firms, and random seeds. Each configuration needs many trajectories before a stable pattern can be separated from an accident of initialization. Repeated games learned by decentralized agents are noisy. Some runs converge near Nash. Some drift upward. Some cycle. A small sample can make these paths look like theory when they are only variance.

The gain from parallel environments is not just speed. It is experimental throughput. Higher throughput makes systematic sweeps feasible under a finite budget of time and hardware. That changes what can be claimed. Without vectorized or parallel execution, the temptation is obvious: reduce the number of seeds, shorten training, or drop treatments that are expensive to run. Each shortcut weakens inference. A design that looks broad in principle becomes narrow in practice.

Differences across information structures often appear in dispersion before they appear in averages. A bandit environment may produce the same mean outcome as a richer environment while generating very different stability properties across runs. That only becomes visible when many replications are available. Parallel execution preserves the width of the experimental grid instead of forcing premature simplification.

Cournot Competition

In the Cournot environment, firms choose quantities simultaneously. Aggregate output is

and inverse demand is

Firm earns

This profit is the reward returned by the environment. Given the action vector , the environment computes , updates the market price, and assigns profits to each agent. The one-shot benchmark comes from each firm’s first-order condition, taking rivals’ quantities as given. In a symmetric Nash equilibrium,

The collusive benchmark is the monopoly allocation for total output,

Under symmetry, each firm would produce . Since collusion in Cournot means restricting output, the natural collusion index is written on the quantity side:

If , the learned outcome matches Nash. If , it matches the monopoly benchmark. Negative values indicate output above the Nash level, so competition is more aggressive than the one-shot benchmark. The state space still depends on information. Under bandit feedback, the agent observes only profit. Under aggregate information, it may observe or . Under complete information, it can also observe rivals’ quantities. The economic game is fixed. The environment changes because the observation interface changes.

Cournot also provides a useful contrast for the Bertrand case. Its symmetric Nash benchmark is closed form. Once parameters are fixed, the target is immediate. That simplicity makes it easier to separate learning dynamics from equilibrium computation.

Bertrand Competition

In the Bertrand environment, firms choose prices instead of quantities. Demand follows the logit structure used by Calvano et al. (2020):

Profit is

With homogeneous goods in the textbook Bertrand model, Nash drives price to marginal cost. Logit demand changes the geometry. Each firm faces a smooth residual demand curve, so the first-order condition becomes

Using the logit derivative,

the condition can be rewritten as

At a symmetric equilibrium with for all , all firms choose the same price and the same demand level . The symmetric Nash condition is then

with

This system is implicit. Unlike Cournot, there is no comparable closed-form expression for . The Bertrand Nash price must be solved numerically once are fixed. The benchmark itself is already a fixed point.

The monopoly benchmark is the symmetric price that maximizes joint industry profit. The collusion index is written on the price side:

If , the learned outcome is Nash. If , it reaches the monopoly benchmark. Negative values indicate prices below the Nash level. Strategic structure is the key difference from Cournot. Quantities are strategic substitutes. Prices under differentiated demand are strategic complements. When one firm raises its price, the incentive for others to raise theirs becomes stronger. That does not guarantee collusion. It changes the slope of best responses. In learning terms, it creates an environment where gradual upward movements can reinforce each other, even though undercutting remains profitable locally. The RL agent sees rewards and observations. The economist sees a strategic system with a different geometry. The environment has to preserve both.

References