A C++ library for simulating supply chain inventory management systems.
ChainSim simulates daily inventory operations including demand fulfillment, purchase ordering, lead time delays, and stock tracking.
Places fixed-size orders when inventory falls below a calculated reorder point.
PurchaseROP policy(5, 50.0); // lead time, average daily demandCalculates optimal order quantities based on ordering and holding costs.
PurchaseEOQ policy(5, 50.0, 100.0, 0.2); // lead time, demand, ordering cost, holding costReviews inventory at fixed intervals and orders up to a target level.
PurchaseTPOP policy(5, 50.0, 7); // lead time, average demand, review period#include "ChainSimBuilder.h"
#include "purchase_policies/PurchaseROP.h"
int main() {
auto sim = qz::ChainSimBuilder("MySimulation")
.simulation_length(30)
.lead_time(5)
.average_demand(50.0)
.starting_inventory(100)
.build();
sim.initialize_simulation();
PurchaseROP policy(5, 50.0);
sim.simulate(policy);
auto results = sim.get_simulation_records();
}- CMake 3.15+
- C++17 compiler
- Git
mkdir build && cd build
cmake ..
make
ctest # Run tests./chainsim [options]Key options:
--policy <ROP|TPOP|EOQ|EBQ|CUSTOM>: Purchase policy--simulation_length <days>: Simulation duration--average_demand <units>: Mean demand per time unit--lead_time <days>: Average delivery delay--starting_inventory <units>: Initial stock level--log_level <0-2>: Logging verbosity
Example:
./chainsim --policy ROP --simulation_length 60 --average_demand 100The simulation generates a CSV file with daily records:
- inventory_quantity
- demand_quantity
- procurement_quantity
- purchase_quantity
- sale_quantity
- lost_sale_quantity