SupplyNetPy API Reference

SupplyNetPy includes a submodule called Components, which helps you create supply chain networks by providing their parts, such as nodes, links and customer demands, and assembling them into a network. The Components module contains three submodules, core, logger and utilities. The pages that follow describe each of them, module by module and class by class. The words used on these pages are explained in the Glossary.

The core module creates the parts of a supply chain. It includes the classes RawMaterial, Product, Inventory, Node, Link, Supplier, Manufacturer, InventoryNode and Demand, the statistics of a node (Statistics) and of a link (LinkStatistics), the replenishment policies (SSReplenishment, RQReplenishment, PeriodicReplenishment), and the supplier-selection policies (SelectFirst, SelectAvailable, SelectCheapest, SelectFastest, SelectProbabilistic). Every node created with these classes runs in a SimPy environment. The Inventory class keeps the inventory of a site, one product per inventory, in a SimPy Container, and can also record how the inventory level changes. For a different kind of inventory with custom behavior, extend Inventory or SimPy Container. The node_type of a node is checked against the NodeType enum, and can be given as a string in any letter case or as an enum member such as scm.NodeType.SUPPLIER. The core module also exports set_seed(seed), which seeds the random numbers the whole library uses, so runs can be repeated exactly.

The logger module keeps the simulation logs. It includes the GlobalLogger class, a common logger for all the parts of the simulation. You can set it up to save logs to a file or to print them to the console. A global_logger instance for the whole package is also exported, so you can call scm.global_logger.disable_logging() or scm.global_logger.enable_logging() to switch all simulation logs off or on at once.

The utilities module provides useful Python functions that save manual work. It contains functions for creating supply chains (create_sc_net), running simulations (simulate_sc_net), starting the statistics again after a warm-up (reset_stats), and inspecting or drawing the resulting network (get_sc_net_info, print_node_wise_performance, print_link_wise_performance, visualize_sc_net). It also contains the Network class, which holds a network and its results. create_sc_net builds a network either from plain dict descriptions or from ready made Node, Link and Demand objects, but each of its lists must use only one of the two.

Each submodule lists its public names in __all__, and SupplyNetPy.Components exports exactly these names.

Guides

For tasks that use several parts together, the User Guide explains how to do them step by step.

  • Customer Demand. How often customers order and how many units, demand from recorded data, what customers do when the site is short, and delivering their orders.
  • Replenishment Policies. Choosing a built in policy, when it checks, safety stock, and writing your own policy.
  • Supplier Selection. Choosing a supplier-selection policy, fixed and dynamic mode, choosing suppliers at random, and writing your own policy.
  • Disruptions. Scheduled and random disruptions of sites and links, what happens to orders, and units lost in a disruption.
  • Perishable Products. Shelf life, batches and their manufacturing dates, when units expire, and expired units in the statistics.
  • Statistics and Results. Results for the whole network, statistics of nodes and links, and warm-ups.
  • Running Experiments. Replications, seeds, comparing settings fairly, confidence intervals, and running replications in parallel.

SupplyNetPy Library Hierarchy

SupplyNetPy
├── Components
│   ├── core.py
│   ├── logger.py
│   ├── utilities.py