/// <summary> /// This is called to decide about potentially pending bundles. /// This method is being timed for statistical purposes and is also ONLY called when <code>SituationInvestigated</code> is <code>false</code>. /// Hence, set the field accordingly to react on events not tracked by this outer skeleton. /// </summary> protected override void DecideAboutPendingBundles() { foreach (var bundle in _pendingBundles.ToArray()) { // Find a pod Pod chosenPod = null; // Check whether we can recycle the last used pod if (_config.StickToPodUntilFull && _lastChosenPod != null && _lastChosenPod.FitsForReservation(bundle)) { // Last chosen pod can be used for this bundle to chosenPod = _lastChosenPod; } else { // Choose the next pod to use randomly chosenPod = Instance.Pods .Where(b => b.FitsForReservation(bundle)) .OrderBy(b => Instance.Randomizer.NextDouble()) .FirstOrDefault(); _lastChosenPod = chosenPod; } // If we found a pod, assign the bundle to it if (chosenPod != null) { AddToReadyList(bundle, chosenPod); } } }
/// <summary> /// This is called to decide about potentially pending bundles. /// This method is being timed for statistical purposes and is also ONLY called when <code>SituationInvestigated</code> is <code>false</code>. /// Hence, set the field accordingly to react on events not tracked by this outer skeleton. /// </summary> protected override void DecideAboutPendingBundles() { foreach (var bundle in _pendingBundles.ToArray()) { // Find a pod Pod chosenPod = null; // Check whether we can recycle the last used pod if (_config.StickToPodUntilFull && _lastChosenPod != null && _lastChosenPod.FitsForReservation(bundle)) { // Last chosen pod can be used for this bundle to chosenPod = _lastChosenPod; } else { // Choose the emptiest pod next chosenPod = Instance.Pods .Where(b => b.FitsForReservation(bundle)) .ArgMin(b => (b.CapacityInUse + b.CapacityReserved) / b.Capacity); _lastChosenPod = chosenPod; } // If we found a pod, assign the bundle to it if (chosenPod != null) { AddToReadyList(bundle, chosenPod); } } }
/// <summary> /// This is called to decide about potentially pending bundles. /// This method is being timed for statistical purposes and is also ONLY called when <code>SituationInvestigated</code> is <code>false</code>. /// Hence, set the field accordingly to react on events not tracked by this outer skeleton. /// </summary> protected override void DecideAboutPendingBundles() { foreach (var bundle in _pendingBundles.ToArray()) { // Find a pod Pod chosenPod = null; // Check whether we can recycle the last used pod if (_config.StickToPodUntilFull && _lastChosenPod != null && _lastChosenPod.FitsForReservation(bundle)) { // Last chosen pod can be used for this bundle to chosenPod = _lastChosenPod; } else { // Choose the next pod to use by selecting the one with least demand for its content chosenPod = Instance.Pods .Where(b => b.FitsForReservation(bundle)) .ArgMin(b => b.ItemDescriptionsContained.Sum(i => Instance.StockInfo.GetCurrentDemand(i))); _lastChosenPod = chosenPod; } // If we found a pod, assign the bundle to it if (chosenPod != null) { AddToReadyList(bundle, chosenPod); } } }