Autonomous Compounding Flywheel Dynamics & Counterfactual Policy Simulator
Solves continuous-time Forrester system dynamics and Monte Carlo Tree Search (MCTS) POMDP planning to optimize non-linear compounding growth loops.
Traditional growth marketing relies on myopic conversion rate optimizations (CRO) that treat marketing channels as static linear funnels. In complex market environments, greedy paid customer acquisition triggers severe balancing friction: audience fatigue, brand entropy, and steep CAC inflation.
flywheel-engine treats enterprise growth as a continuous-time non-linear dynamical system. By modeling stocks of addressable audience, active customer equity, brand trust manifolds, and ad saturation drag, it integrates forward trajectories using Runge-Kutta 4th Order (RK4) and plans multi-quarter interventions via Monte Carlo Tree Search (MCTS) with Upper Confidence Bounds for Trees (UCT).
The system state vector
Evaluates the continuous Jacobian matrix
Simulates forward trajectories over multi-quarter horizons using UCT action selection:
git clone https://github.com/AAH20/flywheel-engine.git
cd flywheel-engineZero third-party dependencies. Runs on pure Python 3.10+ standard library.
from flywheel_engine import SystemDynamicsEngine, SystemState, MCTSGrowthPlanner, CounterfactualSimulator
engine = SystemDynamicsEngine()
state = SystemState(audience=5000.0, active_users=500.0, brand_equity=10.0, cac_drag=0.05)
planner = MCTSGrowthPlanner(engine=engine, horizon_months=6, simulations_per_step=100)
action = planner.plan_next_action(state)
print(f"Optimal strategic policy: {action.value}")python3 -m unittest discover -s tests -vMIT License. Authored by Ahmed Hassan.