|
|
|
|
@ -1169,6 +1169,7 @@ class OptimumCostModel:
|
|
|
|
|
total_corrective_costs = np.zeros(max_interval)
|
|
|
|
|
total_preventive_costs = np.zeros(max_interval)
|
|
|
|
|
total_procurement_costs = np.zeros(max_interval)
|
|
|
|
|
total_costs = np.zeros(max_interval)
|
|
|
|
|
total_failures = np.zeros(max_interval)
|
|
|
|
|
|
|
|
|
|
for equipment in equipments:
|
|
|
|
|
@ -1204,6 +1205,7 @@ class OptimumCostModel:
|
|
|
|
|
procurement_costs = [r["procurement_cost"] for r in predicted_costs]
|
|
|
|
|
procurement_details = [r["procurement_details"] for r in predicted_costs]
|
|
|
|
|
failures = [(1-r["reliability"]) for r in predicted_costs]
|
|
|
|
|
total_costs = [r['total_cost'] for r predicted_costs]
|
|
|
|
|
|
|
|
|
|
# Pad arrays to max_interval length
|
|
|
|
|
def pad_array(arr, target_length):
|
|
|
|
|
@ -1215,6 +1217,7 @@ class OptimumCostModel:
|
|
|
|
|
preventive_costs = pad_array(preventive_costs, max_interval)
|
|
|
|
|
procurement_costs = pad_array(procurement_costs, max_interval)
|
|
|
|
|
failures = pad_array(failures, max_interval)
|
|
|
|
|
total_costs = pad_array(total_costs, max_interval)
|
|
|
|
|
|
|
|
|
|
fleet_results.append(
|
|
|
|
|
CalculationEquipmentResult( # Assuming this class exists
|
|
|
|
|
@ -1231,15 +1234,17 @@ class OptimumCostModel:
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Aggregate costs using vectorized operations
|
|
|
|
|
# Aggregate costs using veoptimal_resultctorized operations
|
|
|
|
|
total_corrective_costs += np.array(corrective_costs)
|
|
|
|
|
total_preventive_costs += np.array(preventive_costs)
|
|
|
|
|
total_procurement_costs += np.array(procurement_costs)
|
|
|
|
|
total_costs += np.array(total_costs)
|
|
|
|
|
|
|
|
|
|
# Calculate fleet optimal interval
|
|
|
|
|
total_costs = total_corrective_costs + total_preventive_costs + total_procurement_costs
|
|
|
|
|
# total_costs = total_corrective_costs + total_preventive_costs + total_procurement_costs
|
|
|
|
|
fleet_optimal_index = np.argmin(total_costs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
calculation.optimum_oh_day = fleet_optimal_index
|
|
|
|
|
calculation.max_interval = max_interval-1
|
|
|
|
|
|
|
|
|
|
|