/// <summary> /// Returns the measured combined frequency of the given item type tuple. This value is updated throughout the simulation. /// </summary> /// <param name="item1">The first part of the item tuple.</param> /// <param name="item2">The second part of the item tuple.</param> /// <returns>The combined frequency of both items. This is a value between 0 and 1.</returns> public double GetMeasuredFrequency(ItemDescription item1, ItemDescription item2) { if (!_combinedTracking) { throw new InvalidOperationException("Combined frequency tracking is disabled!"); } if (_combinedItemFrequencies.ContainsKey(item1, item2)) { return(_combinedItemFrequencies[item1, item2]); } else { return(0); } }
public static void GenerateRotterdamControllers() { // --> Begin Console.WriteLine("Initializing ..."); // --> Initialize sets of configurations to generate later on List <PathPlanningConfiguration> pathplanners = new List <PathPlanningConfiguration>() { // WHCA_v^* new WHCAvStarPathPlanningConfiguration() { Name = "WHCAv", AutoSetParameter = false, LengthOfAWaitStep = 2, RuntimeLimitPerAgent = 0.1, Clocking = 1, LengthOfAWindow = 20, AbortAtFirstConflict = true, UseDeadlockHandler = true, }, }; List <TaskAllocationConfiguration> taskAllocaters = new List <TaskAllocationConfiguration>() { // Balanced work amount new BalancedTaskAllocationConfiguration() { Name = "Pile-on", PodSelectionConfig = new DefaultPodSelectionConfiguration() { OutputPodScorer = new PCScorerPodForOStationBotWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.Picks, BacklogWeight = 0, CompleteableOrderBoost = 0, CompleteableQueuedOrders = false, TimeCosts = 0 }, OutputPodScorerTieBreaker1 = new PCScorerPodForOStationBotCompleteable() { IncludeQueuedOrders = false }, OutputPodScorerTieBreaker2 = new PCScorerPodForOStationBotRandom() { }, OutputExtendedSearchScorer = new PCScorerOStationForBotWithPodWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.Picks, OnlyPositiveLateness = true }, OutputExtendedSearchScorerTieBreaker1 = new PCScorerOStationForBotWithPodWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.Picks, OnlyPositiveLateness = false }, OutputExtendedSearchScorerTieBreaker2 = new PCScorerOStationForBotWithPodRandom() { }, InputPodScorer = new PCScorerPodForIStationBotWorkAmount() { }, InputPodScorerTieBreaker1 = new PCScorerPodForIStationBotRandom() { }, InputPodScorerTieBreaker2 = new PCScorerPodForIStationBotRandom() { }, InputExtendedSearchScorer = new PCScorerIStationForBotWithPodWorkAmount() { }, InputExtendedSearchScorerTieBreaker1 = new PCScorerIStationForBotWithPodRandom() { }, InputExtendedSearchScorerTieBreaker2 = new PCScorerIStationForBotWithPodRandom() { }, }, }, // Balanced work amount new BalancedTaskAllocationConfiguration() { Name = "Age", PodSelectionConfig = new DefaultPodSelectionConfiguration() { OutputPodScorer = new PCScorerPodForOStationBotWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.OrderAge, BacklogWeight = 0, CompleteableOrderBoost = 0, CompleteableQueuedOrders = false, TimeCosts = 0 }, OutputPodScorerTieBreaker1 = new PCScorerPodForOStationBotCompleteable() { IncludeQueuedOrders = false }, OutputPodScorerTieBreaker2 = new PCScorerPodForOStationBotRandom() { }, OutputExtendedSearchScorer = new PCScorerOStationForBotWithPodWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.OrderAge, OnlyPositiveLateness = true }, OutputExtendedSearchScorerTieBreaker1 = new PCScorerOStationForBotWithPodWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.OrderAge, OnlyPositiveLateness = false }, OutputExtendedSearchScorerTieBreaker2 = new PCScorerOStationForBotWithPodRandom() { }, InputPodScorer = new PCScorerPodForIStationBotWorkAmount() { }, InputPodScorerTieBreaker1 = new PCScorerPodForIStationBotRandom() { }, InputPodScorerTieBreaker2 = new PCScorerPodForIStationBotRandom() { }, InputExtendedSearchScorer = new PCScorerIStationForBotWithPodWorkAmount() { }, InputExtendedSearchScorerTieBreaker1 = new PCScorerIStationForBotWithPodRandom() { }, InputExtendedSearchScorerTieBreaker2 = new PCScorerIStationForBotWithPodRandom() { }, }, }, // Balanced pile on age new BalancedTaskAllocationConfiguration() { Name = "Lateness", PodSelectionConfig = new DefaultPodSelectionConfiguration() { OutputPodScorer = new PCScorerPodForOStationBotWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.OrderDueTime, OnlyPositiveLateness = true, BacklogWeight = 0, CompleteableOrderBoost = 0, CompleteableQueuedOrders = false, TimeCosts = 0 }, OutputPodScorerTieBreaker1 = new PCScorerPodForOStationBotWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.OrderDueTime, OnlyPositiveLateness = false, BacklogWeight = 0, CompleteableOrderBoost = 0, CompleteableQueuedOrders = false, TimeCosts = 0 }, OutputPodScorerTieBreaker2 = new PCScorerPodForOStationBotRandom() { }, OutputExtendedSearchScorer = new PCScorerOStationForBotWithPodWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.OrderDueTime, OnlyPositiveLateness = true }, OutputExtendedSearchScorerTieBreaker1 = new PCScorerOStationForBotWithPodWorkAmount() { ValueMetric = PCScorerWorkAmountValueMetric.OrderDueTime, OnlyPositiveLateness = false }, OutputExtendedSearchScorerTieBreaker2 = new PCScorerOStationForBotWithPodRandom() { }, InputPodScorer = new PCScorerPodForIStationBotWorkAmount() { }, InputPodScorerTieBreaker1 = new PCScorerPodForIStationBotRandom() { }, InputPodScorerTieBreaker2 = new PCScorerPodForIStationBotRandom() { }, InputExtendedSearchScorer = new PCScorerIStationForBotWithPodWorkAmount() { }, InputExtendedSearchScorerTieBreaker1 = new PCScorerIStationForBotWithPodRandom() { }, InputExtendedSearchScorerTieBreaker2 = new PCScorerIStationForBotWithPodRandom() { }, }, }, // Nearest new BalancedTaskAllocationConfiguration() { Name = "Nearest", PodSelectionConfig = new DefaultPodSelectionConfiguration() { OutputPodScorer = new PCScorerPodForOStationBotNearest() { }, OutputPodScorerTieBreaker1 = new PCScorerPodForOStationBotRandom() { }, OutputPodScorerTieBreaker2 = new PCScorerPodForOStationBotRandom() { }, OutputExtendedSearchScorer = new PCScorerOStationForBotWithPodNearest() { }, OutputExtendedSearchScorerTieBreaker1 = new PCScorerOStationForBotWithPodRandom() { }, OutputExtendedSearchScorerTieBreaker2 = new PCScorerOStationForBotWithPodRandom() { }, InputPodScorer = new PCScorerPodForIStationBotNearest() { }, InputPodScorerTieBreaker1 = new PCScorerPodForIStationBotRandom() { }, InputPodScorerTieBreaker2 = new PCScorerPodForIStationBotRandom() { }, InputExtendedSearchScorer = new PCScorerIStationForBotWithPodNearest() { }, InputExtendedSearchScorerTieBreaker1 = new PCScorerIStationForBotWithPodRandom() { }, InputExtendedSearchScorerTieBreaker2 = new PCScorerIStationForBotWithPodRandom() { }, }, }, // Demand new BalancedTaskAllocationConfiguration() { Name = "Demand", PodSelectionConfig = new DefaultPodSelectionConfiguration() { OutputPodScorer = new PCScorerPodForOStationBotDemand() { }, OutputPodScorerTieBreaker1 = new PCScorerPodForOStationBotRandom() { }, OutputPodScorerTieBreaker2 = new PCScorerPodForOStationBotRandom() { }, OutputExtendedSearchScorer = new PCScorerOStationForBotWithPodNearest() { }, OutputExtendedSearchScorerTieBreaker1 = new PCScorerOStationForBotWithPodRandom() { }, OutputExtendedSearchScorerTieBreaker2 = new PCScorerOStationForBotWithPodRandom() { }, InputPodScorer = new PCScorerPodForIStationBotDemand() { }, InputPodScorerTieBreaker1 = new PCScorerPodForIStationBotRandom() { }, InputPodScorerTieBreaker2 = new PCScorerPodForIStationBotRandom() { }, InputExtendedSearchScorer = new PCScorerIStationForBotWithPodNearest() { }, InputExtendedSearchScorerTieBreaker1 = new PCScorerIStationForBotWithPodRandom() { }, InputExtendedSearchScorerTieBreaker2 = new PCScorerIStationForBotWithPodRandom() { }, }, }, // Random new BalancedTaskAllocationConfiguration() { Name = "Random", PodSelectionConfig = new DefaultPodSelectionConfiguration() { OutputPodScorer = new PCScorerPodForOStationBotRandom() { }, OutputPodScorerTieBreaker1 = new PCScorerPodForOStationBotRandom() { }, OutputPodScorerTieBreaker2 = new PCScorerPodForOStationBotRandom() { }, OutputExtendedSearchScorer = new PCScorerOStationForBotWithPodRandom() { }, OutputExtendedSearchScorerTieBreaker1 = new PCScorerOStationForBotWithPodRandom() { }, OutputExtendedSearchScorerTieBreaker2 = new PCScorerOStationForBotWithPodRandom() { }, InputPodScorer = new PCScorerPodForIStationBotRandom() { }, InputPodScorerTieBreaker1 = new PCScorerPodForIStationBotRandom() { }, InputPodScorerTieBreaker2 = new PCScorerPodForIStationBotRandom() { }, InputExtendedSearchScorer = new PCScorerIStationForBotWithPodRandom() { }, InputExtendedSearchScorerTieBreaker1 = new PCScorerIStationForBotWithPodRandom() { }, InputExtendedSearchScorerTieBreaker2 = new PCScorerIStationForBotWithPodRandom() { }, }, }, }; List <ItemStorageConfiguration> itemStoragers = new List <ItemStorageConfiguration>() { // Random new RandomItemStorageConfiguration() { Name = "Random", StickToPodUntilFull = false }, // Closest new ClosestLocationItemStorageConfiguration() { Name = "Nearest" }, // Emptiest new EmptiestItemStorageConfiguration() { Name = "Emptiest" }, // Turnover new TurnoverItemStorageConfiguration() { Name = "Class" }, // LeastDemand new LeastDemandItemStorageConfiguration() { Name = "LeastDemand" }, }; List <PodStorageConfiguration> podStoragers = new List <PodStorageConfiguration>() { // Random new RandomPodStorageConfiguration() { Name = "Random" }, // Fixed new FixedPodStorageConfiguration() { Name = "Fixed" }, // Nearest new NearestPodStorageConfiguration() { Name = "Nearest" }, // Station based new StationBasedPodStorageConfiguration() { Name = "StationBased" }, // Turnover new TurnoverPodStorageConfiguration() { Name = "Class" }, }; List <ReplenishmentBatchingConfiguration> replenishmentBatchers = new List <ReplenishmentBatchingConfiguration>() { // Random new RandomReplenishmentBatchingConfiguration() { Name = "Random" }, // SamePod (least busy station) new SamePodReplenishmentBatchingConfiguration() { Name = "SamePod", FirstStationRule = SamePodFirstStationRule.LeastBusy }, }; List <OrderBatchingConfiguration> orderBatchers = new List <OrderBatchingConfiguration>() { // Random new DefaultOrderBatchingConfiguration() { Name = "Random", OrderSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOrderSelection.Random, StationSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOutputStationSelection.Random, }, // FCFS new DefaultOrderBatchingConfiguration() { Name = "FCFS", OrderSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOrderSelection.FCFS, StationSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOutputStationSelection.Random, }, // Earliest due time new DefaultOrderBatchingConfiguration() { Name = "DueTime", OrderSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOrderSelection.DueTime, StationSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOutputStationSelection.Random, }, // Lines in common new LinesInCommonOrderBatchingConfiguration() { Name = "CommonLines", TieBreaker = Core.Control.Shared.OrderSelectionTieBreaker.Random, FastLane = false, FastLaneTieBreaker = Core.Control.Shared.FastLaneTieBreaker.Random, }, // Pod matching new PodMatchingOrderBatchingConfiguration() { Name = "PodMatch", TieBreaker = Core.Control.Shared.OrderSelectionTieBreaker.Random, FastLane = false, FastLaneTieBreaker = Core.Control.Shared.FastLaneTieBreaker.Random, LateBeforeMatch = false, }, // Fast lane new DefaultOrderBatchingConfiguration() { Name = "FastLane", OrderSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOrderSelection.Random, StationSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOutputStationSelection.Random, FastLane = true, FastLaneTieBreaker = Core.Control.Shared.FastLaneTieBreaker.Random, }, //// Late matching //new PodMatchingOrderBatchingConfiguration() { // Name = "PodMatchLate", // FastLane = false, // UseEarliestDueTime = false, // LateBeforeMatch = true, //}, }; // --> Create collection of forbidden combinations that shall not be generated Console.WriteLine("Creating forbidden combinations ..."); SymmetricKeyDictionary <ControllerConfigurationBase, bool> forbiddenCombinations = new SymmetricKeyDictionary <ControllerConfigurationBase, bool>(); foreach (var replenishmentBatcher in replenishmentBatchers.Where(r => r is SamePodReplenishmentBatchingConfiguration)) { foreach (var itemStorager in itemStoragers.Where(i => i is ClosestLocationItemStorageConfiguration)) { forbiddenCombinations[replenishmentBatcher, itemStorager] = true; } } // --> Generate the configurations Console.WriteLine("Generating all configurations ..."); List <ControlConfiguration> configurations = new List <ControlConfiguration>(); foreach (var pathPlanner in pathplanners) { foreach (var taskAllocater in taskAllocaters) { foreach (var itemStorager in itemStoragers) { foreach (var podStorager in podStoragers) { foreach (var replenishmentBatcher in replenishmentBatchers) { foreach (var orderBatcher in orderBatchers) { // Check for invalid combinations List <ControllerConfigurationBase> configObjects = new List <ControllerConfigurationBase>() { pathPlanner, taskAllocater, itemStorager, podStorager, replenishmentBatcher, orderBatcher }; bool isInvalid = false; foreach (var firstConfig in configObjects) { foreach (var secondConfig in configObjects.Where(c => c != firstConfig)) { if (forbiddenCombinations.ContainsKey(firstConfig, secondConfig)) { isInvalid = true; } } } // Add the config if it is not invalid if (!isInvalid) { configurations.Add(new ControlConfiguration() { PathPlanningConfig = pathPlanner, TaskAllocationConfig = taskAllocater, ItemStorageConfig = itemStorager, PodStorageConfig = podStorager, ReplenishmentBatchingConfig = replenishmentBatcher, OrderBatchingConfig = orderBatcher, }); } } } } } } } // --> Save configurations Console.WriteLine("Writing all configurations ..."); foreach (var config in configurations) { // Prepare config.Name = "PP" + config.PathPlanningConfig.Name + "-" + "TA" + config.TaskAllocationConfig.Name + "-" + "IS" + config.ItemStorageConfig.Name + "-" + "PS" + config.PodStorageConfig.Name + "-" + "OB" + config.OrderBatchingConfig.Name + "-" + "RB" + config.ReplenishmentBatchingConfig.Name; // Make last minute changes if (config.PodStorageConfig is TurnoverPodStorageConfiguration && !(config.ItemStorageConfig is TurnoverItemStorageConfiguration)) { (config.PodStorageConfig as TurnoverPodStorageConfiguration).ReallocationDelay = 1200; } // Save string fileName = config.Name + ".xconf"; Console.WriteLine("Saving " + fileName + " ..."); InstanceIO.WriteConfiguration(fileName, config); // Revert last minute changes if (config.PodStorageConfig is TurnoverPodStorageConfiguration && !(config.ItemStorageConfig is TurnoverItemStorageConfiguration)) { (config.PodStorageConfig as TurnoverPodStorageConfiguration).ReallocationDelay = 0; } } }