supplychainpy package

Subpackages

Submodules

supplychainpy.launch_reports module

class supplychainpy.launch_reports.ReportsLauncher

Bases: threading.Thread

Launches reporting lauch panel

print_message()

Prints launch message

run()
class supplychainpy.launch_reports.SupplychainpyReporting(master)

Bases: object

Creates report launcher gui, to launch browser and using flask local server. Allows port number to be changed.

show_port_entry()
spawn_reports()

Checks if port number is specified, then validates port number.

supplychainpy.launch_reports.exit_report()

Exits reports

supplychainpy.launch_reports.launch_browser(event, url: str)

Launches web browser

supplychainpy.launch_reports.launch_load_report(file: str, location: str = None)
supplychainpy.launch_reports.launch_report(location: str = None, port: int = 5000, host: str = '127.0.0.1')
supplychainpy.launch_reports.launch_report_server(location: str = None, port: int = 5000, host: str = '127.0.0.1')
supplychainpy.launch_reports.load_db(file: str, location: str = None)

supplychainpy.model_decision module

supplychainpy.model_decision.analytical_hierarchy_process(criteria: tuple, criteria_scores: list, options: tuple, option_scores: dict, quantitative_criteria: tuple = None, **kwargs)

Compute an analytical hierarchy for alternative choices based on relative weights and priorities of categories.

Parameters:
  • criteria (tuple) – List the criteria to base decision between alternative choices.
  • criteria_scores (list) – List the scores for the criteria as a list of tuples, the reciprocals are auto-calculated.
  • options (tuple) – The alternative otpions to decide between.
  • option_scores (dict) – A dict of tuples scoring the alternatives. The tuple order must mirror the ‘alternative’ argument tuple.
  • quantitative_criteria (tuple) – List the quantitative criteria e.g. ‘fuel economy’, that use representative values and not scores
  • **kwargs – item_cost (dict): A dict of alternatives and their corresponding costs. Only necessary if seeking to use cost benefit ratios for further discretion.
Returns:

Summary of analytical hierarchy and cost benefit analysis if kwargs ‘item_cost’ used.

Return type:

dict

Examples:

>>> lorry_cost = {'scania': 68000,'iveco': 79000,'volvo': 59000,'navistar': 66000}
>>> criteria = ('style', 'reliability', 'fuel_economy')
>>> criteria_scores = [(1, 1 / 2, 3), (0, 1, 4), (0, 0, 1)]
>>> options = ('scania', 'iveco', 'volvo', 'navistar')
>>> options_scores ={'reliability': [(1, 2, 5, 1), (1 / 2, 1, 3, 2), (1 / 5, 1 / 3, 1, 1 / 4), (1, 1 / 2, 4, 1)],
...     'style': [(1, 1 / 4, 4, 1 / 6), (4, 1, 4, 1 / 4),(1 / 4, 1 / 4, 1, 1 / 5), (6, 4, 5, 1)],
...     'fuel_economy': (62, 55, 56, 56)}
>>> lorry_decision = analytical_hierarchy_process(criteria= criteria, criteria_scores=criteria_scores,
...     options= options, option_scores=options_scores, quantitative_criteria=('fuel_economy',),
...     item_cost = lorry_cost)

supplychainpy.model_demand module

supplychainpy.model_demand.holts_trend_corrected_exponential_smoothing_forecast(demand: list, alpha: float, gamma: float, forecast_length: int = 4, initial_period: int = 6, optimise: bool = True) → dict

Performs a holt’s trend corrected exponential smoothing forecast on known demand

Parameters:
  • demand (list) – Original historical demand.
  • alpha (float) – smoothing constant
  • gamma (float) –
  • forecast_length (int) –
  • initial_period (int) –
  • optimise (bool) – Flag for using solver. Default is set to True.
Returns:

Simple exponential forecast.

Return type:

dict

supplychainpy.model_demand.holts_trend_corrected_exponential_smoothing_forecast_from_file(file_path: str, file_type: str, length: int, alpha: float, gamma: float, **kwargs) → dict
Parameters:
  • file_path – Path to source file.
  • file_type – File type.
  • length – Number of periods in data source (Jan..Dec = 12).
  • alpha
  • gamma
  • **kwargs

Returns:

supplychainpy.model_demand.simple_exponential_smoothing_forecast(demand: list, smoothing_level_constant: float = 0.5, optimise: bool = True, forecast_length: int = 5, initial_estimate_period: int = 6, **kwargs) → dict

Performs a simple exponential smoothing forecast on historical demand.

Parameters:
  • forecast_length (int) – Number of periods to extend the forecast.
  • demand (list) – Original historical demand.
  • smoothing_level_constant (float) – Alpha value
  • initial_estimate_period (int) – Number of period to use to derive an average for the initial estimate.
  • **ds (pd.DataFrame) – Data frame with raw data.
  • **optimise (bool) –
Returns:

Simple exponential forecast

Return type:

dict

Examples:

>>> from supplychainpy.model_demand import simple_exponential_smoothing_forecast
>>> orders = [165, 171, 147, 143, 164, 160, 152, 150, 159, 169, 173, 203, 169, 166, 162, 147, 188, 161, 162,
...           169, 185, 188, 200, 229, 189, 218, 185, 199, 210, 193, 211, 208, 216, 218, 264, 304]
>>> ses = simple_exponential_smoothing_forecast(demand=orders, alpha=0.5, forecast_length=6, initial_period=18)
supplychainpy.model_demand.simple_exponential_smoothing_forecast_from_file(file_path: str, file_type: str, length: int, smoothing_level_constant: float = 0.5, forecast_length=5, optimise: bool = True) → dict

Performs a simple exponential smoothing forecast on historical demand from file using a generator.

Parameters:
  • file_path (str) – Path to source file.
  • file_type (str) – File type.
  • length (int) – Number of periods in data source (Jan..Dec = 12).
  • smoothing_level_constant (int) – Alpha value for forecast.
  • forecast_length (int) – Number of periods to extend the forecast.
  • optimise (bool) – Optimisation flag for exponential smoothing forecast.
Returns:

Simple exponential forecast.

Return type:

dict

supplychainpy.model_distribution module

supplychainpy.model_inventory module

supplychainpy.model_inventory.analyse(currency: str, z_value: decimal.Decimal = 1.28, reorder_cost: decimal.Decimal = 10, interval_length: int = 12, interval_type: str = 'month', **kwargs)

Performs several types of common inventory analysis on the raw demand data. Including safety stock, reorder levels.

Parameters:
  • currency (Decimal) – Currency the raw data is stored in.
  • z_value (Decimal) – Service level requirement
  • reorder_cost (Decimal) – Cost to place a reorder based on the cost of operations over the period
  • interval_length (Decimal) – The number of periods the demand data is grouped into e.g. 12 (months)
  • interval_type (Decimal) – months, weeks,days, years, quarters.
Keyword Arguments:
 
  • **df (pd.DataFrame) – Pandas DataFrame containing the raw data in the correct format.
  • **file_path (str) – Path to csv or txt file containing formatted data.
Returns:

Analysis of inventory profile.

Return type:

dict/pd.DataFrame

Examples

>>> from supplychainpy.model_inventory import analyse
>>> from supplychainpy.sample_data.config import ABS_FILE_PATH
>>> from decimal import Decimal
>>> analysed_data = analyse(file_path=ABS_FILE_PATH['COMPLETE_CSV_SM'],
...                         z_value=Decimal(1.28),
...                         reorder_cost=Decimal(400),
...                         retail_price=Decimal(455),
...                         file_type='csv',
...                         currency='USD')
>>> analysis = [demand.orders_summary() for demand in analysed_data]
>>> # Example using pandas DataFrame.
>>> import pandas as pd
>>> raw_df = pd.read_csv(ABS_FILE_PATH['COMPLETE_CSV_SM'])
>>> analyse_kv = dict(
...     df=raw_df,
...     start=1,
...     interval_length=12,
...     interval_type='months',
...     z_value=Decimal(1.28),
...     reorder_cost=Decimal(400),
...     retail_price=Decimal(455),
...     file_type='csv',
...     currency='USD'
... )
>>> analysis_df = analyse(**analyse_kv)
supplychainpy.model_inventory.analyse_orders(data_set: dict, sku_id: str, lead_time: decimal.Decimal, unit_cost: decimal.Decimal, reorder_cost: decimal.Decimal, z_value: decimal.Decimal, retail_price: decimal.Decimal, quantity_on_hand: decimal.Decimal, currency: str = 'USD') → dict

Analyse orders data for one sku using a dictionary.

Analyses orders data for a single sku using the values in the data_set dict.

Parameters:
  • data_set (dict) – The orders data for a specified period.
  • sku_id (str) – The unique id of the sku.
  • lead_time (Decimal) – The average lead-time for the sku over the period represented by the data, in the same unit.
  • unit_cost (Decimal) – The unit cost of the sku to the organisation.
  • reorder_cost (Decimal) – The cost to place a reorder. This is usually the cost of the operation divided by number of purchase orders placed in the previous period.
  • z_value (Decimal) – The service level required to calculate the safety stock.
  • retail_price (Decimal) – The retail or standard price of the sku.
  • quantity_on_hand (Decimal) – The quantity currently on hand as of analysis or retrieving data set.
  • currency (str) – Currency of source raw data.
Returns:

The summary of the analysis.

{‘ABC_XYZ_Classification’: ‘AX’, ‘reorder_quantity’: ‘258’, ‘revenue’: ‘2090910.44’, ‘average_order’: ‘539’, ‘reorder_level’: ‘813’, ‘economic_order_quantity’: ‘277’, ‘sku’: ‘RR381-33’, ‘demand_variability’: ‘0.052’, ‘economic_order_variable_cost’: ‘29557.61’, ‘standard_deviation’: ‘28’, ‘safety_stock’: ‘51’}

Return type:

dict

Raises:

ValueError – Dataset too small. Please use a minimum of 3 entries.

Examples

>>> from supplychainpy.model_inventory import analyse_orders
>>> from supplychainpy.sample_data.config import ABS_FILE_PATH
>>> from decimal import Decimal
>>> yearly_demand = {'jan': 75, 'feb': 75, 'mar': 75, 'apr': 75, 'may': 75, 'jun': 75, 'jul': 25,
...                 'aug': 25, 'sep': 25, 'oct': 25, 'nov': 25, 'dec': 25}
>>>
>>> summary = analyse_orders(yearly_demand,
...                          sku_id='RX983-90',
...                          lead_time=Decimal(3),
...                          unit_cost=Decimal(50.99),
...                          reorder_cost=Decimal(400),
...                          z_value=Decimal(1.28),
...                          retail_price=Decimal(600),
...                          quantity_on_hand=Decimal(390))
supplychainpy.model_inventory.analyse_orders_abcxyz_from_file(file_path: str, z_value: decimal.Decimal, reorder_cost: decimal.Decimal, file_type: str = 'text', period: str = 'month', length: int = 12, currency: str = 'USD') → list

Analyse orders data from file and returns ABCXYZ analysis

Analyses orders data for a single sku, using the values from a file arranged in columns.The data should be arranged in two columns, 1 for the period and the other for the corresponding data-point.

Parameters:
  • file_path (str) – The path to the file containing two columns of data, 1 period and 1 data-point for 1 sku.
  • reorder_cost (Decimal) – The average lead-time for the sku over the period represented by the data, in the same unit.
  • length (int) – The number of periods in the data-ser referenced from the second column of the row onwards.
  • reorder_cost – The cost to place a reorder. This is usually the cost of the operation divided by number of purchase orders placed in the previous period.
  • z_value (Decimal) – The service level required to calculate the safety stock
  • file_type (str) – Type of ‘file csv’ or ‘text’
  • period (str) – The period of time the data points are bucketed into.
  • currency (str) –
Returns:

An AbcXyz class object is returned.

Return type:

list

Raises:
  • Exception – Incorrect file type specified. Please specify ‘csv’ or ‘text’ for the file_type parameter.
  • Exception – Unspecified file type, Please specify ‘csv’ or ‘text’ for file_type parameter.

Examples:

>>> from decimal import Decimal
>>> from supplychainpy.model_inventory import analyse_orders_from_file_col
>>> from supplychainpy.sample_data.config import ABS_FILE_PATH
>>> abc = analyse_orders_abcxyz_from_file(file_path=ABS_FILE_PATH['COMPLETE_CSV_SM'],
...                                                          z_value=Decimal(1.28),
...                                                          reorder_cost=Decimal(5000),
...                                                          file_type="csv")
supplychainpy.model_inventory.analyse_orders_from_file_col(file_path, sku_id: str, lead_time: decimal.Decimal, unit_cost: decimal.Decimal, reorder_cost: decimal.Decimal, z_value: decimal.Decimal, retail_price: decimal.Decimal, file_type: str = 'text', period: str = 'months', currency='USD') → dict

Analyse orders from file arranged in a single column.

Analyses orders data for a single sku, using the values from a file arranged in columns.The data should be arranged in two columns, 1 for the period and the other for the corresponding data-point.

Parameters:
  • file_path (str) – The path to the file containing two columns of data, 1 period and 1 data-point for 1 sku.
  • sku_id (str) – The unique id of the sku.
  • lead_time (Decimal) – The average lead-time for the sku over the period represented by the data, in the same unit.
  • unit_cost (Decimal) – The unit cost of the sku to the organisation.
  • reorder_cost (Decimal) – The cost to place a reorder. This is usually the cost of the operation divided by number of purchase orders placed in the previous period.
  • z_value (Decimal) – The service level required to calculate the safety stock
  • retail_price (Decimal) – The price at which the sku is retailed.
  • file_type (str) – Type of ‘file csv’ or ‘text’
  • period (int) – The period of time the data points are bucketed into.
  • currency (str) – The currency of the source data.
Returns:

The summary of the analysis.

{‘ABC_XYZ_Classification’: ‘AX’, ‘reorder_quantity’: ‘258’, ‘revenue’: ‘2090910.44’, ‘average_order’: ‘539’, ‘reorder_level’: ‘813’, ‘economic_order_quantity’: ‘277’, ‘sku’: ‘RR381-33’, ‘demand_variability’: ‘0.052’, ‘economic_order_variable_cost’: ‘29557.61’, ‘standard_deviation’: ‘28’, ‘safety_stock’: ‘51’}

Return type:

dict

Raises:
  • Exception – Incorrect file type specified. Please specify ‘csv’ or ‘text’ for the file_type parameter.
  • Exception – Unspecified file type, Please specify ‘csv’ or ‘text’ for file_type parameter.

Examples:

>>> from decimal import Decimal
>>> from supplychainpy.model_inventory import analyse_orders_from_file_col
>>> from supplychainpy.sample_data.config import ABS_FILE_PATH
>>> # text file
>>> RX9304_43_analysis_txt = analyse_orders_from_file_col(file_path=ABS_FILE_PATH['PARTIAL_COL_TXT_SM'],
...                                                   sku_id='RX9304-43',
...                                                   lead_time=Decimal(2),
...                                                   unit_cost=Decimal(400),
...                                                   reorder_cost=Decimal(45),
...                                                   z_value=Decimal(1.28),
...                                                   file_type='text',
...                                                   retail_price=Decimal(30))
>>> #csv file
>>> RX9304_43_analysis_csv = analyse_orders_from_file_col(ABS_FILE_PATH['PARTIAL_COL_CSV_SM'], 'RX9304-43',
...                                                     reorder_cost=Decimal(45),
...                                                     unit_cost=Decimal(400),
...                                                     lead_time=Decimal(45),
...                                                     z_value=Decimal(1.28),
...                                                     file_type="csv",
...                                                     retail_price=Decimal(30))
supplychainpy.model_inventory.analyse_orders_from_file_row(file_path: str, z_value: decimal.Decimal, reorder_cost: decimal.Decimal, retail_price: decimal.Decimal, file_type: str = 'text', period: str = 'month', length: int = 12, currency: str = 'USD') → list

Analyse multiple SKUs from a file with data arranged by row.

Parameters:
  • file_path (file) – The path to the file containing two columns of data, 1 period and 1 data-point for 1 sku.
  • reorder_cost (Decimal) – The cost to place a reorder. This is usually the cost of the operation divided by number of purchase orders placed in the previous period.
  • z_value (Decimal) – The service level required to calculate the safety stock
  • file_type (str) – Type of ‘file csv’ or ‘text’
  • period (str) – The period of time the data points are bucketed into.
  • length (int) – The length of the period.
Returns:

A list of summaries containint

Return type:

list

Raises:
  • Exception – Incorrect file type specified. Please specify ‘csv’ or ‘text’ for the file_type parameter.
  • Exception – Unspecified file type, Please specify ‘csv’ or ‘text’ for file_type parameter.

Examples: >>> from supplychainpy.model_inventory import analyse_orders_from_file_row >>> from supplychainpy.sample_data.config import ABS_FILE_PATH >>> analysed_data = analyse_orders_from_file_row(file_path=ABS_FILE_PATH[‘COMPLETE_CSV_SM’], … reorder_cost=Decimal(45), … z_value=Decimal(1.28), … file_type=”csv”, … retail_price=Decimal(30), … currency=’USD’)

supplychainpy.model_inventory.recommendations(analysed_orders: supplychainpy.inventory.analyse_uncertain_demand.UncertainDemand, forecast: dict) → dict

Generate Recommendations for each SKU and the inventory Profile.

Parameters:
  • analysed_orders (UncertainDemand) – UncertainDemand object of analysed orders.
  • forecast (dict) – Output from a Forecast.
Returns:

Returns recommendations for each sku and for the inventory profile.

Return type:

dict

Examples: >>> from decimal import Decimal >>> from supplychainpy.sample_data.config import ABS_FILE_PATH >>> from supplychainpy.model_inventory import analyse >>> from supplychainpy.model_inventory import recommendations … >>> analysed_order = analyse(file_path=ABS_FILE_PATH[‘COMPLETE_CSV_SM’], … z_value=Decimal(1.28), … reorder_cost=Decimal(5000), … file_type=”csv”, length=12,currency=’USD’) … >>> holts_forecast = {analysis.sku_id: analysis.holts_trend_corrected_forecast for analysis in … analyse(file_path=ABS_FILE_PATH[‘COMPLETE_CSV_SM’], z_value=Decimal(1.28), … reorder_cost=Decimal(5000), file_type=”csv”, … length=12,currency=’USD’)} … >>> recommend = recommendations(analysed_orders=analysed_order, forecast=holts_forecast)

supplychainpy.model_inventory.summarise(analysed_orders: supplychainpy.inventory.analyse_uncertain_demand.UncertainDemand)

supplychainpy.model_production module

supplychainpy.model_warehouse module

supplychainpy.scratch module

supplychainpy.simulate module

supplychainpy.simulate.get_demand(orders_analysis, period_length)
supplychainpy.simulate.optimise_service_level(frame_summary: list, orders_analysis: list, service_level: float, runs: int, percentage_increase: float) → list

Optimises the safety stock for declared service level.

Identifies which skus under performed (experiencing a service level lower than expected) after simulating transactions over a specific period. The safety stock for these items are increased and the analysis is monte carlo is run again.

Parameters:
  • frame_summary (list) – window summary for each period multiplied by the number of runs.
  • orders_analysis (list) – prior analysis of orders data.
  • service_level (list) – required service level as a percentage.
  • runs (int) – number of runs from previous
  • percentage_increase (float) – the percentage increase required
Returns:

Updated orders analysis with new saftey stock values based optimised from the simulation. The initial values

from the analytical model.

Return type:

list

supplychainpy.simulate.random_demand(orders_analysis=None, period_length=None) → list
supplychainpy.simulate.run_monte_carlo(orders_analysis: list, runs: int, period_length: int = 12) → list

Runs monte carlo simulation.

Generates random distribution for demand over period specified and creates a simulation window for opening_stock, demand, closing_stock, delivery and backlog for each sku in the data set. Creates a transaction summary window for inventory movements.

Parameters:
  • orders_analysis (list) – list of UncertainDemand objects, containing the results of inventory analysis.
  • period_length (int) – The number of periods define the simulation window e.g. 12 weeks, months etc.
  • runs (int) – The number of times to run the simulation.
Returns:

A list containing the transaction summary for each period.

[[{‘closing_stock’: ‘0’, ‘backlog’: ‘240’, ‘po_quantity’: ‘6009’, ‘po_raised’: ‘PO 49’, ‘revenue’: ‘1145799’, ‘opening_stock’: ‘1700’, ‘index’: ‘9’, ‘period’: ‘1’, ‘shortage_units’: ‘240.4612’, ‘po_received’: ‘’, ‘delivery’: ‘0’, ‘shortage_cost’: ‘48621’, ‘demand’: ‘1940’, ‘quantity_sold’: ‘1699’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘240’, ‘backlog’: ‘852’, ‘po_quantity’: ‘6380’, ‘po_raised’: ‘PO 59’, ‘revenue’: ‘0’, ‘opening_stock’: ‘0’, ‘index’: ‘9’, ‘period’: ‘2’, ‘shortage_units’: ‘611.5989’, ‘po_received’: ‘’, ‘delivery’: ‘0’, ‘shortage_cost’: ‘123665’, ‘demand’: ‘612’, ‘quantity_sold’: ‘0’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘0’, ‘backlog’: ‘383’, ‘po_quantity’: ‘6152’, ‘po_raised’: ‘PO 69’, ‘revenue’: ‘162070’, ‘opening_stock’: ‘240’, ‘index’: ‘9’, ‘period’: ‘3’, ‘shortage_units’: ‘383.4993’, ‘po_received’: ‘’, ‘delivery’: ‘0’, ‘shortage_cost’: ‘77543’, ‘demand’: ‘624’, ‘quantity_sold’: ‘240’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘4463’, ‘backlog’: ‘383’, ‘po_quantity’: ‘1689’, ‘po_raised’: ‘PO 79’, ‘revenue’: ‘2749508’, ‘opening_stock’: ‘0’, ‘index’: ‘9’, ‘period’: ‘4’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘PO 49’, ‘delivery’: ‘6010’, ‘shortage_cost’: ‘0’, ‘demand’: ‘1547’, ‘quantity_sold’: ‘4079’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘8002’, ‘backlog’: ‘0’, ‘po_quantity’: ‘0’, ‘po_raised’: ‘’, ‘revenue’: ‘5393458’, ‘opening_stock’: ‘4463’, ‘index’: ‘9’, ‘period’: ‘5’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘PO 59’, ‘delivery’: ‘6381’, ‘shortage_cost’: ‘0’, ‘demand’: ‘2841’, ‘quantity_sold’: ‘8002’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘13594’, ‘backlog’: ‘0’, ‘po_quantity’: ‘0’, ‘po_raised’: ‘’, ‘revenue’: ‘9162457’, ‘opening_stock’: ‘8002’, ‘index’: ‘9’, ‘period’: ‘6’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘PO 69’, ‘delivery’: ‘6153’, ‘shortage_cost’: ‘0’, ‘demand’: ‘561’, ‘quantity_sold’: ‘13594’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘13144’, ‘backlog’: ‘0’, ‘po_quantity’: ‘0’, ‘po_raised’: ‘’, ‘revenue’: ‘8859056’, ‘opening_stock’: ‘13594’, ‘index’: ‘9’, ‘period’: ‘7’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘PO 79’, ‘delivery’: ‘1690’, ‘shortage_cost’: ‘0’, ‘demand’: ‘2140’, ‘quantity_sold’: ‘13144’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘11666’, ‘backlog’: ‘0’, ‘po_quantity’: ‘0’, ‘po_raised’: ‘’, ‘revenue’: ‘7862688’, ‘opening_stock’: ‘13144’, ‘index’: ‘9’, ‘period’: ‘8’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘’, ‘delivery’: ‘0’, ‘shortage_cost’: ‘0’, ‘demand’: ‘1478’, ‘quantity_sold’: ‘11665’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘8542’, ‘backlog’: ‘0’, ‘po_quantity’: ‘0’, ‘po_raised’: ‘’, ‘revenue’: ‘5757540’, ‘opening_stock’: ‘11666’, ‘index’: ‘9’, ‘period’: ‘9’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘’, ‘delivery’: ‘0’, ‘shortage_cost’: ‘0’, ‘demand’: ‘3123’, ‘quantity_sold’: ‘8542’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘7832’, ‘backlog’: ‘0’, ‘po_quantity’: ‘0’, ‘po_raised’: ‘’, ‘revenue’: ‘5278665’, ‘opening_stock’: ‘8542’, ‘index’: ‘9’, ‘period’: ‘10’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘’, ‘delivery’: ‘0’, ‘shortage_cost’: ‘0’, ‘demand’: ‘710’, ‘quantity_sold’: ‘7831’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘5379’, ‘backlog’: ‘0’, ‘po_quantity’: ‘389’, ‘po_raised’: ‘PO 149’, ‘revenue’: ‘3625634’, ‘opening_stock’: ‘7832’, ‘index’: ‘9’, ‘period’: ‘11’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘’, ‘delivery’: ‘0’, ‘shortage_cost’: ‘0’, ‘demand’: ‘2453’, ‘quantity_sold’: ‘5379’, ‘sku_id’: ‘KR202-217’}] [{‘closing_stock’: ‘3799’, ‘backlog’: ‘0’, ‘po_quantity’: ‘1969’, ‘po_raised’: ‘PO 159’, ‘revenue’: ‘2560610’, ‘opening_stock’: ‘5379’, ‘index’: ‘9’, ‘period’: ‘12’, ‘shortage_units’: ‘0.000000’, ‘po_received’: ‘’, ‘delivery’: ‘0’, ‘shortage_cost’: ‘0’, ‘demand’: ‘1580’, ‘quantity_sold’: ‘3799’, ‘sku_id’: ‘KR202-217’}],…]

Return type:

list

supplychainpy.simulate.run_transactions(random_demand: list, period_length: int, orders_analysis: list) → list
supplychainpy.simulate.summarise_frame(window_summary)

Summarizes the simulation frame Generates a summary for run window, into 1 transaction summary for all the runs.

Parameters:window_summary (list) – window summary for each period multiplied by the number of runs.
Returns:
[{‘variance_opening_stock’: ‘5007’, ‘maximum_opening_stock’: 13805, ‘maximum_backlog’: 2278.0,
’minimum_quantity_sold’: 0.0, ‘average_backlog’: ‘218’, ‘minimum_opening_stock’: 0, ‘average_quantity_sold’: ‘7204’, ‘maximum_quantity_sold’: 13805.0, ‘minimum_closing_stock’: 0, ‘standard_deviation_backlog’: ‘628’, ‘standard_deviation_quantity_sold’: ‘4636’, ‘maximum_closing_stock’: 13805, ‘standard_deviation_closing_stock’: ‘4755’, ‘average_shortage_units’: ‘2278’, ‘service_level’: ‘91.67’,’minimum_backlog’: 0.0, ‘average_closing_stock’: ‘7115’, ‘sku_id’: ‘KR202-240’},…]
Return type:list
supplychainpy.simulate.summarize_window(simulation_frame: list, period_length: int = 12)

Summarizes the simulation window and provides the stockout percentage for each sku.

Provides a summary of inventory transactions, for the full period length for each run.

Parameters:
  • simulation_frame (list) – A collection of simulation windows.
  • period_length (int) – The number of periods define the simulation window e.g. 12 weeks, months etc.
Returns:

A list containing the results for each sku.[{‘maximum_opening_stock’: 13181.0,

’standard_deviation_closing_stock’: 4407.468727436796, ‘standard_deviation_backlog’: 485.2568835735928, ‘variance_backlog’: 235474.24305555542, ‘minimum_backlog’: 0.0, ‘maximum_closing_stock’: 13181.0, ‘standard_deviation_shortage_cost’: 348.8327422580442, ‘variance_opening_stock’: 20387450.520833332, ‘average_opening_stock’: 6350.75, ‘minimum_quantity_sold’: 0.0, ‘standard_deviation_opening_stock’: 4515.246451837744, ‘stockout_percentage’: 0.0833333358168602, ‘maximum_backlog’: 1337.0, ‘sku_id’: ‘KR202-240’, ‘standard_deviation_revenue’: 4489.574661244527, ‘maximum_quantity_sold’: 13181.0, ‘total_quantity_sold’: 76742.0, ‘variance_quantity_sold’: 20156280.638888914, ‘minimum_closing_stock’: 0.0, ‘variance_closing_stock’: 19425780.583333332, ‘variance_shortage_units’: 121684.28207126712, ‘index’: ‘32’, ‘average_closing_stock’: 6461.5, ‘total_shortage_units’: 1337.80962, ‘maximum_shortage_units’: 1266.604, ‘minimum_shortage_units’: 0.0, ‘average_backlog’: 216.9166717529297, ‘minimum_opening_stock’: 0.0}…]

Return type:

list

supplychainpy.supplychain module

supplychainpy.supplychain.main()

Module contents