Skip to main content

SupplyNetPy

SupplyNetPy is a Python library designed for modeling, simulation, design exploration, and optimization of supply chains and inventory systems. It allows users to create and simulate supply chain networks with various inventory replenishment policies.

Installation

You can install SupplyNetPy using pip.

pip install supplynetpy

Dependencies

pip installs all three for you.

Authors

Quick Start

Creating supply chain networks

A small network with an infinite supplier, one distributor that reorders with an (s, S) policy, and a customer demand of 10 units every time unit.

import SupplyNetPy.Components as scm

supplier1 = {'ID': 'S1', 'name': 'Supplier1', 'node_type': 'infinite_supplier'}

distributor1 = {'ID': 'D1', 'name': 'Distributor1', 'node_type': 'distributor', 
                'capacity': 150, 'initial_level': 50, 'inventory_holding_cost': 0.2, 
                'replenishment_policy': scm.SSReplenishment, 'policy_param': {'s':100,'S':150},
                'product_buy_price': 100,'product_sell_price': 105}

link1 = {'ID': 'L1', 'source': 'S1', 'sink': 'D1', 'cost': 5, 'lead_time': lambda: 2}

demand1 = {'ID': 'd1', 'name': 'Demand1', 'order_arrival_model': lambda: 1,
            'order_quantity_model': lambda: 10, 'demand_node': 'D1'}

# create a supply chain network
supplychainnet = scm.create_sc_net(nodes=[supplier1, distributor1], links=[link1], demands=[demand1])

# simulate for 20 time units (read here as days)
supplychainnet = scm.simulate_sc_net(supplychainnet, sim_time=20, logging=True)

Modeling what a disruption does to stored inventory

In real life, a disruption is rarely just a pause. A flood can ruin every box in a warehouse, a power cut can spoil refrigerated goods, contamination can force a partial recall, and theft can take part of the inventory. SupplyNetPy lets you describe these physical effects on inventory, in addition to simply marking a node as disrupted.

The basic disruption settings (failure_p, node_disrupt_time) only mark the node as disrupted, so it receives no new orders. They leave its units untouched. To say what actually happens to the units at the node when a disruption starts, set the disruption_impact option as shown below.

# Scenario 1, total loss (for example a warehouse fire or a flood). Destroys all units at the node.
scm.InventoryNode(..., disruption_impact="destroy_all")

# Scenario 2, partial loss (for example a power cut that spoils some refrigerated goods).
# Here, 30% of the inventory level is destroyed each time a disruption starts.
# You can also pass a function instead of 0.3 to randomize the loss each time.
scm.InventoryNode(..., disruption_impact="destroy_fraction",
                  disruption_loss_fraction=0.3)

# Scenario 3, anything more specific (for example contamination of half the units).
# Write a small Python function that describes what to do, and pass it in.
def contaminate(node):
    node.inventory.destroy(amount=node.inventory.level * 0.5,
                           reason="contamination")
scm.InventoryNode(..., disruption_impact=contaminate)

The loss is applied once, at the moment the disruption starts (not repeatedly while it lasts). The units lost and their value are saved on the node as node.stats.destroyed_qty and node.stats.destroyed_value, and the value is automatically subtracted when the simulation calculates the node's profit, so you don't need to do that bookkeeping yourself.

The words used here (inventory level, disruption, customer demand, and so on) are defined in the Glossary.

Documentation

For detailed documentation and advanced usage, please refer to the official documentation.

Metadata

Release files for supplynetpy 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for supplynetpy 0.4.0
File Size Uploaded
supplynetpy-0.4.0.tar.gz 137.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for supplynetpy 0.4.0
File Interpreter ABI Platform
supplynetpy-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 219.1 kB

Release files / supplynetpy-0.4.0.tar.gz

Download URL supplynetpy-0.4.0.tar.gz
Size 137.7 kB
Tags Source
SHA-256 checksum
How to use checksums
663e684239fbde62e4a972d0ea1d55a492714c4aa2bb101a358601cee7c4f230
BLAKE2b-256 checksum
How to use checksums
79e933ff912d53748c156e0774fd72bc88e5923be62cac9121e97cf3a33df50c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / supplynetpy-0.4.0-py3-none-any.whl

Download URL supplynetpy-0.4.0-py3-none-any.whl
Size 81.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31926d81c0dab0defce924fa7fbe11dab33320f017e8141a11dbf719b14971d5
BLAKE2b-256 checksum
How to use checksums
3c6e1936b4c7369b5c47a69945932eadc0ef7e53239c07d2ec925c2f87abe146
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release history Release notifications | RSS feed

0.5.0

2 release files

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.12

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page