def test_slow_factory_simulator_with_jobs_hypothesis( profile_ind, t, at, override, simulator_type ): products = [ Product( id=i + l * n_levels, production_level=l, name=f"{l}_{i}", catalog_price=(i + 1) * (l + 1), expires_in=None, ) for i in range(n_products) for l in range(n_levels) ] processes = [ Process( id=i + l * n_levels, production_level=l, name=f"p{l}_{i}", inputs=[ InputOutput(product=i + (l - 1) * n_levels, quantity=3, step=0.0), InputOutput(product=i + (l - 1) * n_levels, quantity=2, step=0.0), ], outputs=[ InputOutput(product=i + l * n_levels, quantity=1, step=1.0), InputOutput(product=i + l * n_levels, quantity=2, step=1.0), ], historical_cost=1 + i + l * n_levels, ) for i in range(n_processes) for l in range(1, n_levels) ] profiles = [ ManufacturingProfile( n_steps=i + 1, cost=10 * (i + 1), initial_pause_cost=1, running_pause_cost=2, resumption_cost=3, cancellation_cost=4, line=l, process=p, ) for i, (p, l) in enumerate(zip(processes, itertools.cycle(range(n_lines)))) ] simulator_type = ( SlowFactorySimulator if simulator_type == "slow" else FastFactorySimulator ) simulator = simulator_type( initial_wallet=initial_wallet, initial_storage=initial_storage, n_steps=n_steps, n_products=len(products), profiles=profiles, max_storage=max_storage, ) do_simulator_run(simulator, profiles, t, at, profile_ind, override)
def processes(): return [ Process( id=i + l * n_levels, production_level=l, name=f"p{l}_{i}", inputs=[ InputOutput(product=i + (l - 1) * n_levels, quantity=3, step=0.0), InputOutput(product=i + (l - 1) * n_levels, quantity=2, step=0.0), ], outputs=[ InputOutput(product=i + l * n_levels, quantity=1, step=1.0), InputOutput(product=i + l * n_levels, quantity=2, step=1.0), ], historical_cost=1 + i + l * n_levels, ) for i in range(n_processes) for l in range(1, n_levels) ]
sample_products = [ Product(id=i + l * n_levels, production_level=l, name=f'{l}_{i}', catalog_price=(i + 1) * (l + 1), expires_in=None) for i in range(n_products) for l in range(n_levels) ] sample_processes = [ Process(id=i + l * n_levels, production_level=l, name=f'p{l}_{i}', inputs={ InputOutput(product=i + (l - 1) * n_levels, quantity=3, step=0.0), InputOutput(product=i + (l - 1) * n_levels, quantity=2, step=0.0) }, outputs={ InputOutput(product=i + l * n_levels, quantity=1, step=1.0), InputOutput(product=i + l * n_levels, quantity=2, step=1.0) }, historical_cost=1 + i + l * n_levels) for i in range(n_processes) for l in range(1, n_levels) ] sample_profiles = [ ManufacturingProfile(n_steps=i + 1, cost=10 * (i + 1),