Giter VIP home page Giter VIP logo

deliverysim's Introduction

DeliverySim

A concurrent food delivery system simulator written in Go.

How to Use

First, compile the project with

go build

then run

./deliverysim

For example, use the following command to run a simulation using a sample profile that comes with the repositry.

./deliverysim profile/default-fifo.json

Simulation Profile

A simulation profile is a JSON file that defines the parameters for a simulation run. Several profiles are provided in the profile/ directory.

For illustration, below is what a simulation profile looks like.

{
    "Name": "Matched - Default",
    "Desc": "Default profile for Matched courier dispatch strategy.",
    "Order": {
        "SourceFile": "./data/dispatch_orders.json",
        "Rate": 2,
        "Limit": -1
    },
    "Kitchen": {
        "Capacity": 100,
        "CounterSize": 30
    },
    "Courier": {
        "DispatchStrategy": "Matched",
        "PoolSize": 100,
        "TravelTime": [3, 15]
    },
    "DebugMode": false
}

Supported parameters

Name - Name of the profile Desc - A description of the profile

Order

  • SourceFile - Path to the order data. A sample is provided at data/dispatch_orders.json
  • Rate - Number of orders per second the system receives
  • Limit - Total number of orders to issue. If set to -1, the System will use all available orders in the SourceFile

Kitchen

  • Capacity - Number of orders the kitchen can process (cook) simultaneously.
  • CounterSize - Max number of orders waiting for pickup on the counter before the kitchen has to stop cooking (out of counter space)

Courier

  • PoolSize - Number of couriers
  • DispatchStrategy (FIFO/Matched) - FIFO - first courier to arrive gets to pick up deliver first. Matched All orders are pre-matched with a courier.
  • TravelTime (Integer array with 2 elements) - How long does it take for the courier to arrive? This parameter defines the range of courier travel time. Actual travel time is randomized.

DebugMode (true|false) - show debug message if set to true

Sample Simulation Profiles

These profiles can be found in the /profile directory

  • default-fifo.json - Courier dispatch and pickup are done in a FIFO manner
  • default-matched.json - Courier dispatch and pickup are matched with a particular order
  • matched-slow_courier.json - Couriers are matched but they're very slow. For this test, the food wait time is expected to be longer.
  • fifo-fast-courier.json - Orders are picked up on a first-come-first-serve basis and the couriers arrive instant. The courier wait time is expected to be long for this scenario.
  • fifo-ddos.json - A ton of orders are placed in an instant but the kitchen is tiny and the courier pool is small.
  • fifo-one-order.json - a single order.
  • matched-one-order.json - a single order

Tested with

Go 1.18.3 Linux

deliverysim's People

Contributors

hankcheah avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.