|
|
|
|
@ -17,36 +17,36 @@ from src.overhaul_scope.service import get as get_scope
|
|
|
|
|
from .schema import CalculationResultsRead
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def get_overhaul_cost_by_time_chart(overhaul_cost: float, days: int,numEquipments:int ,decay_base: float = 1.1) -> np.ndarray:
|
|
|
|
|
# if overhaul_cost < 0:
|
|
|
|
|
# raise ValueError("Overhaul cost cannot be negative")
|
|
|
|
|
# if days <= 0:
|
|
|
|
|
# raise ValueError("Days must be positive")
|
|
|
|
|
|
|
|
|
|
# exponents = np.arange(0, days)
|
|
|
|
|
# cost_per_equipment = overhaul_cost / numEquipments
|
|
|
|
|
# # Using a slower decay base to spread the budget depletion over more days
|
|
|
|
|
# results = cost_per_equipment / (decay_base ** exponents)
|
|
|
|
|
# results = np.where(np.isfinite(results), results, 0)
|
|
|
|
|
# return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_overhaul_cost_by_time_chart(overhaul_cost: float, days: int, numEquipments: int, decay_base: float = 1.1) -> np.ndarray:
|
|
|
|
|
def get_overhaul_cost_by_time_chart(overhaul_cost: float, days: int,numEquipments:int ,decay_base: float = 1.1) -> np.ndarray:
|
|
|
|
|
if overhaul_cost < 0:
|
|
|
|
|
raise ValueError("Overhaul cost cannot be negative")
|
|
|
|
|
if days <= 0:
|
|
|
|
|
raise ValueError("Days must be positive")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exponents = np.arange(0, days)
|
|
|
|
|
cost_per_equipment = overhaul_cost / numEquipments
|
|
|
|
|
|
|
|
|
|
# Introduce randomness by multiplying with a random factor
|
|
|
|
|
random_factors = np.random.normal(1.0, 0.1, numEquipments) # Mean 1.0, Std Dev 0.1
|
|
|
|
|
results = np.array([cost_per_equipment * factor / (decay_base ** exponents) for factor in random_factors])
|
|
|
|
|
|
|
|
|
|
# Using a slower decay base to spread the budget depletion over more days
|
|
|
|
|
results = cost_per_equipment / (decay_base ** exponents)
|
|
|
|
|
results = np.where(np.isfinite(results), results, 0)
|
|
|
|
|
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def get_overhaul_cost_by_time_chart(overhaul_cost: float, days: int, numEquipments: int, decay_base: float = 1.1) -> np.ndarray:
|
|
|
|
|
# if overhaul_cost < 0:
|
|
|
|
|
# raise ValueError("Overhaul cost cannot be negative")
|
|
|
|
|
# if days <= 0:
|
|
|
|
|
# raise ValueError("Days must be positive")
|
|
|
|
|
|
|
|
|
|
# exponents = np.arange(0, days)
|
|
|
|
|
# cost_per_equipment = overhaul_cost / numEquipments
|
|
|
|
|
|
|
|
|
|
# # Introduce randomness by multiplying with a random factor
|
|
|
|
|
# random_factors = np.random.normal(1.0, 0.1, numEquipments) # Mean 1.0, Std Dev 0.1
|
|
|
|
|
# results = np.array([cost_per_equipment * factor / (decay_base ** exponents) for factor in random_factors])
|
|
|
|
|
|
|
|
|
|
# results = np.where(np.isfinite(results), results, 0)
|
|
|
|
|
# return results
|
|
|
|
|
|
|
|
|
|
# def get_corrective_cost_time_chart(material_cost: float, service_cost: float, days: int) -> Tuple[np.ndarray, np.ndarray]:
|
|
|
|
|
# day_points = np.arange(0, days)
|
|
|
|
|
|
|
|
|
|
|