Supply-Chain-Bot-Tournament / supply-chain-tournament

Supply Chain Bot Tournament Game Repo - submit a PR to participate!
MIT License
6 stars 7 forks source link

Supply Chain Bot Tournament

Supply Chain Bot Tournament implemented as an OpenAI Gym environment. The core part of the game environment's implementation was forked from this repository.

Overview Image (credits: https://github.com/orlov-ai/beer-game-env/blob/master/docs/open_analytics_screen.png) (credits)

Installation

If you are struggling with any of the steps below, please reach out to us in the official slack channel:

  1. You need a working Python installation of Python 3.8 or Python 3.9. If you are new to Python, we recommend to install Python and all dependencies via a Miniconda: https://docs.conda.io/en/latest/miniconda.html. You should then create a new conda environment. )

    conda create python=3.8 --name supply-chain-env
    conda activate supply-chain-env
  2. Clone the repository, either with the command line or via your favorite git desktop client.

    git clone https://github.com/Supply-Chain-Bot-Tournament/supply-chain-tournament.git
  3. Install the package

    cd supply-chain-tournament
    pip install -e .
  4. Launch the bot.py file to run the game with randomly behaving agents. If everything was setup properly, you'll see a bunch of messaged printed to the standard output showing agents' actions and their outcomes.

    python bot.py

Interpreting the ouput

Without (or after) making any changes to the agents, you should see 20 turns (can be thought of as days), when different data points at each agent are shown. It would be something like:

Turn #:  7
Stocks Levels (at the end of the turn):  -2, 18, 17, 19
Orders Placed:  [[0, 0], [2, 0], [2, 2], [2]]
Shipments Inbound:  [[0, 2], [1, 1], [0, 2], [2, 2]]
Next Incoming Orders:  [8, 0, 2, 2]
Cumulative holding cost:  [27.  42.  46.  47.5]
Cumulative stockout cost:  [2. 0. 0. 0.]
Last holding cost:  [0.  9.  8.5 9.5]
Last stockout cost:  [2. 0. 0. 0.]

Implementing Your Solution

Ideally, each agent will sell everything it got/produced every day - so zero holding costs and will never disappoint a downstream agent, i.e., will never be out of stock and miss a sale - so zero stockout costs, which is obviously only hypothetically possible. Your goal is to implement an approach with which the costs are minimized overall across the supply chain.

In order to implement your solution, open the bot.py file and provide your implementation for all given agents. You don't need to change anything except agents' classes. Also, please note that a valid agent's strategy cannot peek into the game's environment state or communicate internal state to other agents! (See the docstring at the very beginning of the file for additional details).

To test your implementation, run the bot.py script again. The better your solution works, the smaller should be the total cost reported at the end of the game.

Do NOT modify any other files.

Submitting to the Leaderboard

In order to participate in the tournament, you should follow these steps:

  1. Request write-access to this repo by reaching out to the organizers of this event in the PyData Global 2021 Slack Channel. They will add you to a team within the Supply-Chain-Bot-Tournament organization. Please check your emails for an invitation and join the team to be granted write-access.
  2. Once you're happy with your developed strategy, post your changes to a new branch in this repository to trigger the evaluation and open a PR with name "Team your_teamname" to merge to master
  3. GitHub Actions will take care of evaluating your implementation and post your results to the leaderboard (https://example.com/)
  4. Update your branch as often as you like, but be aware that the most recent results will be updated to the leaderboard, irrespectively of the result

Good luck and have fun!