Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Parameters
- n_simulations = 10000
- shortage_factors = {
- 'manpower': 0.15, # 15% reduction in production due to manpower shortages
- 'material': 0.10 # 10% reduction in specific variants due to material shortages
- }
- # Simulation
- results_adjusted = {month: {'tanks': [], 'guns': [], 'carriers': []} for the month in months}
- for _ in range(n_simulations):
- for month in months:
- prop_tanks = np.random.uniform(*proportion_tanks_range)
- prop_guns = np.random.uniform(*proportion_guns_range)
- prop_carriers = np.random.uniform(*proportion_carriers_range)
- total_prop = prop_tanks + prop_guns + prop_carriers
- prop_tanks /= total_prop
- prop_guns /= total_prop
- prop_carriers /= total_prop
- # Apply shortage factors
- adjusted_production = monthly_estimates[month] * (1 - shortage_factors['manpower'])
- adjusted_tanks = prop_tanks * adjusted_production
- adjusted_guns = prop_guns * adjusted_production * (1 - shortage_factors['material'])
- adjusted_carriers = prop_carriers * adjusted_production * (1 - shortage_factors['material'])
- results_adjusted[month]['tanks'].append(adjusted_tanks)
- results_adjusted[month]['guns'].append(adjusted_guns)
- results_adjusted[month]['carriers'].append(adjusted_carriers)
- # Summary statistics
- for month in months:
- print(f"Month: {month}")
- print(f" Tanks: Mean = {np.mean(results_adjusted[month]['tanks'])}, Std Dev = {np.std(results_adjusted[month]['tanks'])}")
- print(f" Guns: Mean = {np.mean(results_adjusted[month]['guns'])}, Std Dev = {np.std(results_adjusted[month]['guns'])}")
- print(f" Carriers: Mean = {np.mean(results_adjusted[month]['carriers'])}, Std Dev = {np.std(results_adjusted[month]['carriers'])}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement