Advertisement
UF6

German Tank Problem/ Panzer III Chassis Type Production

UF6
Aug 2nd, 2024
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.80 KB | Source Code | 0 0
  1. # Parameters
  2. n_simulations = 10000
  3. shortage_factors = {
  4.     'manpower': 0.15, # 15% reduction in production due to manpower shortages
  5.     'material': 0.10   # 10% reduction in specific variants due to material shortages
  6. }
  7.  
  8. # Simulation
  9. results_adjusted = {month: {'tanks': [], 'guns': [], 'carriers': []} for the month in months}
  10. for _ in range(n_simulations):
  11.     for month in months:
  12.         prop_tanks = np.random.uniform(*proportion_tanks_range)
  13.         prop_guns = np.random.uniform(*proportion_guns_range)
  14.         prop_carriers = np.random.uniform(*proportion_carriers_range)
  15.        
  16.         total_prop = prop_tanks + prop_guns + prop_carriers
  17.         prop_tanks /= total_prop
  18.         prop_guns /= total_prop
  19.         prop_carriers /= total_prop
  20.        
  21.         # Apply shortage factors
  22.         adjusted_production = monthly_estimates[month] * (1 - shortage_factors['manpower'])
  23.         adjusted_tanks = prop_tanks * adjusted_production
  24.         adjusted_guns = prop_guns * adjusted_production * (1 - shortage_factors['material'])
  25.         adjusted_carriers = prop_carriers * adjusted_production * (1 - shortage_factors['material'])
  26.        
  27.         results_adjusted[month]['tanks'].append(adjusted_tanks)
  28.         results_adjusted[month]['guns'].append(adjusted_guns)
  29.         results_adjusted[month]['carriers'].append(adjusted_carriers)
  30.  
  31. # Summary statistics
  32. for month in months:
  33.     print(f"Month: {month}")
  34.     print(f"  Tanks: Mean = {np.mean(results_adjusted[month]['tanks'])}, Std Dev = {np.std(results_adjusted[month]['tanks'])}")
  35.     print(f"  Guns: Mean = {np.mean(results_adjusted[month]['guns'])}, Std Dev = {np.std(results_adjusted[month]['guns'])}")
  36.     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