我正在从事一个研究项目,并希望应用并行化来提高执行速度。我之前曾与multiprocessing图书馆合作过,但仅用于数字运算。我将尝试简要描述我的设置和目标。我主要希望来自对多处理概念更有经验的人的想法。
该项目:
该项目是一个多回声供应链模拟(一个多级分销网络),其中根据传入的需求在每个位置定期做出重新订购决策。一个玩具示例如下所示:
Level 3 Level 2 Level 1 Level 0
--- Local Warehouse 1
|
--- Central Warehouse 1 --
| |
| --- Local Warehouse 2
|
Supplier -- Customer
| --- Local Warehouse 3
| |
--- Central Warehouse 2 --
|
--- Local Warehouse 4
Run Code Online (Sandbox Code Playgroud)
模拟对象(简化)如下:
class Simulation:
self.locations = dict() #List of locations
self.customer = Customer() #Object periodically ordering at deepest level (Local) Warehouses
self.levels = {0: [], 1:[],..} # Locations by depth …Run Code Online (Sandbox Code Playgroud)