Skip to content

Developer guides – How to add...

Nikkel Mollenhauer edited this page Jul 24, 2022 · 11 revisions

On this page, short introductions and guides aim at helping developers when adding new features to the framework.

Marketplace

After adding the new marketplace class, please remember to update this list accordingly.

To add a new marketplace class, you first need to determine the general category it will belong to:

  • Linear economy
  • Circular economy
  • Circular economy with rebuy prices
  • A new economy type

If you choose to add a completely new economy type, the task will be a lot more complex, so we will not cover this scenario in this guide.

In the following, we will cover how to add a new circular economy class, but the general idea is the same for all marketplaces.

First, you need to navigate to the market/linear/linear_sim_market.py file. In here, you can already see all of the current market classes for circular economies, so simply add your new class to the bottom. Please make sure to conform to our naming scheme for marketplace classes:

<FullMarketType><FullMarketEnvironment><AdditionalInfo>

Currently, there are only two methods you need to implement for your new class:

  • get_num_competitors(), a static method that defines how many competitors, other than the first agent can play on this market.
  • _get_competitor_list(), a method that returns a list of pre-initialized vendors that should act as the default competitors on this market if no competitors are provided by the user.

Over time, it might of course be that more methods are required to be implemented, so if you find that on is missing from this list, kindly update it.

Aside from implementing the required methods, you can of course also overwrite existing methods defined in one of the parent classes. For this, take a look at the SimMarket class in market/sim_market.py. You might for example want to implement a custom behaviour for how and when customers arrive in your new market by overriding the _simulate_customers() method.

Vendor

There are two types of vendors in the framework, and the way they are implemented is radically different. Please refer to the correct section below when adding a new vendor class.

Reinforcement learning agent

After adding the new agent class, please remember to update this list accordingly.

Rule based vendor

After adding the new agent class, please remember to update this list accordingly.

CLI command

Default file