LarrySnyder / stockpyl

Python inventory optimization and simulation tools.
GNU General Public License v3.0
87 stars 19 forks source link

Unnecessary external demand sources on non-retailer nodes in non-serial networks #142

Closed bruskey47 closed 3 weeks ago

bruskey47 commented 1 month ago

In the multiproduct branch, when using the "network_from_edges" function to build a network, all nodes have an external demand source (not just the leaf nodes, which should have an external demand source.

network = network_from_edges( edges=[(2, 1), (3, 1), (4, 2)], node_order_in_lists=[1, 2, 3, 4], local_holding_cost=[2,4,2,2],
stockout_cost=[50, 25, 25, 0], demand_type='UD', # discrete uniform distribution, for easier debugging lo=1, hi=5, shipment_lead_time=[1, 1, 1, 0] )

Output has columns, for i=2: IO:EXT|20 IO:1|20 ....

LarrySnyder commented 1 month ago

@bruskey47 This is fixed now. Now network_from_edges() only creates a (non-None) demand source if the node is a sink node, or if the demand source attributes are specified explicitly for that node (i.e., they're not just given as a singleton). Can you check that it works as you expect? If it does, you can close this issue.

bruskey47 commented 3 weeks ago

Issue fixed.