MarketEnv module

class MarketEnv.MarketEnvironment[source]

Bases: Env

A custom environment that simulates a market with two sellers and four buyers.

Each seller sets a price (the action), and each buyer has a certain willingness to pay. The state of the environment consists of the two prices set by the sellers and the current willingness to pay of each buyer.

The episode ends when all buyers have bought the products.

reset()[source]

Reset the state of the environment to an initial state.

Returns

array_like

The initial state of the environment.

step(action)[source]

Execute one time step within the environment.

Parameters

actionarray_like

The prices set by the sellers.

Returns

array_like

The new state of the environment after taking the action.

float

The reward achieved by the action.

bool

A flag denoting whether the episode has ended.

dict

An empty dictionary for additional info (unused in this environment).