How to get started

General steps

  • Register, of course, for free to receive access to the login area.
  • Start developing your algorithms and test that they run without errors and reasonably fast.
  • During the training phase we perform nightly competition runs, you can access and see your performance results in the login area. There you can also upload new algorithms.
  • Submit your final algorithms before the deadline for the ultimate competition simulation.

Algorithm requirements

  • Your code will be executed in a docker container with Python 3.9 and Anaconda distribution 2022.05. We have also added Tensorflow (2.10.0) and PyTorch (1.13.0). If you need additional packages, please contact us and we will add them to the container.
  • The container in which your code runs has 1 CPU and 512 MB of memory and your code is not allowed to use the local file system to save your own log files or anything like this. Further, there is no need for printing out things in your functions, we are not logging your output.
  • When uploading your algorithms on the platform, please name the pricing algorithms “duopoly.py” (1-airline case). This is essential for the competition setup on AWS.
  • The competition setup expects that each of the main scripts contains a function p(.), which we will call, the function is expected to return the price and the information dump.
  • The information dump allows you to pass yourself any kind of information from one time period to the next. But note, that the information dump is reset to None at the beginning of every competition. So you can use the information dump only during the competition to pass back information to yourself in the next time period, but not across simulations. For this you can use the ‘duopoly_feedback.data‘ file, see explanation below.
  • You can use supporting python scripts by simply importing them in your scripts from the current working directory. All your files will be placed in the same directory.
  • Your algorithms need to return a price response on average within 0.2 seconds per time period/iteration and the maximum time for a single price response is 5 seconds. Further, the algorithm needs to be error free in 99% of the price requests.
  • In case we do not receive a valid price response (>0) from your function, we will use your old price from the previous time period. In case your function is not working on the first period in the selling season, we will draw a random price and use that.

Code: duopoly.py with the price function p(.)

A simple example algorithm code with the explanation of the main functionalities can be found here.

The submitted algorithm file needs to be exactly called ‘duopoly.py’ and it needs to contain a pricing function p, which takes the following parameter. The function p(.) returns the tuple of (price, information_dump).


def p(
    current_selling_season: int,
    selling_period_in_current_season: int,
    prices_historical_in_current_season: Union[np.ndarray, None],
    demand_historical_in_current_season: Union[np.ndarray, None],
    competitor_has_capacity_current_period_in_current_season: bool,
    information_dump=Optional[Any],
) -> Tuple[float, Any]:
  • current_selling_season (int): The current selling season (1, 2, 3, …, 100).
  • selling_period_in_current_season (int): The period in the current season (1, 2, …, 100).
  • prices_historical_in_current_season (Union[np.ndarray, None]): A two-dimensional array of historical prices: rows index the competitors and columns index the historical selling periods. Equal to None if selling_period_in_current_season == 1.
  • demand_historical_in_current_season (Union[np.ndarray, None]): A one-dimensional array of historical (own) demand. Equal to None if selling_period_in_current_season == 1.
  • competitor_has_capacity_current_period_in_current_season (bool): False if competitor is out of stock, else False
  • information_dump (Any, optional, default None): Custom object to pass yourself any information object you like from one selling_period to the other within the same competition. Equal to None if selling_period_in_current_season == 1 AND current_selling_season==1, i.e. it is reset at the beginning of each competition (one competition = 100 selling_seasons with each 100 selling periods. To pass information across competitions and also to yourself in the UI, use the ‘duopoly_feedback.data’ file.

Code Testing

Cloud testing environment

In the login area under File Manager, you can upload your duopoly.py file alongside any other supplementary files you need. After the upload, we will start a small test run with your algorithms in the cloud. After approx. 15 minutes you can see the performance results with potential error logs for download in the platform.

Additional getting started information

An example notebook to start analysing the competition detail logs and how to simulate your algorithm locally can be found here.
Usage of duopoly_feedback.data

The DPC environment allows you to store feedback data in a dedicated file. You can use this file to pass your algorithm information across different competitions in the nightly simulation runs, as well as providing yourself information to download in the UI after the competition run. Here is an example to use pickle to store information in this file, but you can use any file format you like.

import pickle

# write any feedback object to file
with open('duopoly_feedback.data', 'wb') as handle:
            pickle.dump(FEEDBACK_OCJECT, handle, protocol=pickle.HIGHEST_PROTOCOL)

# load feedback object
with open('duopoly_feedback.data', 'rb') as handle:
            feedback = pickle.load(handle)

Note, the duopoly_feedback.data file is not persistent over multiple simulation days. Every nightly simulation run starts in a fresh container.

The duopoly_feedback.data file of the nightly simulation run is available for download in the detailed results section of the UI.

Example how to load additional submitted files

You may want to upload additional files, e.g. pickle files. In order to open these files in the competition container, please use the following code example. Your code location in the container is under /root/partcipant_folder/ and therefore please add this to the file location when loading the file.


import pickle

try:
    # for the cloud in container
    with open('/root/partcipant_folder/FILENAME.pkl', 'rb') as f:
        obj = pickle.load(f)
except:
    # for your local testing
    with open('FILENAME.pkl', 'rb') as f:
        obj = pickle.load(f)

Note, you don’t need to take care of this folder structure if you just want to import your custom scripts, simply import them. All your uploaded files will be located in the same folder within the competition container.

Also, theduopoly_feedback.data' does not require this extra path handling. The feedback data object has a special setup to pass to yourself information for download in the DPC website, this file will be available in the website under ‘Download Feedback Data' in the results page.

During the training phase

  • You can upload daily new algorithms.
  • We build a new docker container with your code.
  • At night all containers are started, the competition matches are randomly drawn among the competitors.
  • The simulations are performed, performances are logged and evaluated.
  • You will find your ranking and performance statistics in your login area. There you can also download .csv files with simulation data (your prices, competitor prices and your demand realization).

How it all got started

Curious to know how it all began? Check out the paper below on the very first edition of the competition in 2017.