public static float DeliveryValue(float deliveryTime, PackageInfo packageInfo, TimeValueFunction tvf) { if (deliveryTime > SimulationSettings.DeliveryTimeLimit) { return(0); } float maxRevenue = PayloadGenerator.GetPackageCost(packageInfo) * Mathf.Pow(SimulationSettings.TierModifier, (int)tvf.tier); float penaltyStep = maxRevenue / (float)tvf.numSteps; if (tvf.numSteps == 0) { return(maxRevenue); } int stepsHit = 0; float timeStep = SimulationSettings.TVFStepInterval; for (int i = 0; i < tvf.steps.Count; i++) { if (deliveryTime < timeStep) { break; } timeStep += SimulationSettings.TVFStepInterval; if (tvf.steps[i]) { ++stepsHit; if (stepsHit == tvf.numSteps) { return(0); } } } return(maxRevenue - (penaltyStep * stepsHit)); }
public static float ExpectedProfit(float estimatedTime, float expectedDuration, PackageInfo packageInfo, TimeValueFunction tvf) { float income = DeliveryValue(estimatedTime, packageInfo, tvf); float costs = SimulationSettings.EnergyUseEstimationConstant * expectedDuration; return(income - costs); }