public static void GenerateMaTiInstances() { // Generate MaTi instances RandomizerSimple random = new RandomizerSimple(0); // Generate original MaTi set Instance tiny = InstanceGenerator.GenerateMaTiLayoutTiny(random, new SettingConfiguration(), new ControlConfiguration()); Instance small = InstanceGenerator.GenerateMaTiLayoutSmall(random, new SettingConfiguration(), new ControlConfiguration()); Instance medium = InstanceGenerator.GenerateMaTiLayoutMedium(random, new SettingConfiguration(), new ControlConfiguration()); Instance large = InstanceGenerator.GenerateMaTiLayoutLarge(random, new SettingConfiguration(), new ControlConfiguration()); Instance huge = InstanceGenerator.GenerateMaTiLayoutHuge(random, new SettingConfiguration(), new ControlConfiguration()); InstanceIO.WriteInstance("MaTiTiny.xinst", tiny); InstanceIO.WriteInstance("MaTiSmall.xinst", small); InstanceIO.WriteInstance("MaTiMedium.xinst", medium); InstanceIO.WriteInstance("MaTiLarge.xinst", large); InstanceIO.WriteInstance("MaTiHuge.xinst", huge); // Generate alternative MaTi set InstanceIO.WriteInstance("MaTiPico.xinst", InstanceGenerator.GenerateMaTiLayoutPico(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiNano.xinst", InstanceGenerator.GenerateMaTiLayoutNano(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiMicro.xinst", InstanceGenerator.GenerateMaTiLayoutMicro(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiMilli.xinst", InstanceGenerator.GenerateMaTiLayoutMilli(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiCenti.xinst", InstanceGenerator.GenerateMaTiLayoutCenti(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiDeca.xinst", InstanceGenerator.GenerateMaTiLayoutDeca(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiHecto.xinst", InstanceGenerator.GenerateMaTiLayoutHecto(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiKilo.xinst", InstanceGenerator.GenerateMaTiLayoutKilo(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiMega.xinst", InstanceGenerator.GenerateMaTiLayoutMega(random, new SettingConfiguration(), new ControlConfiguration())); InstanceIO.WriteInstance("MaTiGiga.xinst", InstanceGenerator.GenerateMaTiLayoutGiga(random, new SettingConfiguration(), new ControlConfiguration())); }
private void ReadWaypointsFile(string filePath) { Output("Reading waypoint file: " + filePath); DTOInstance instance = InstanceIO.ReadDTOInstance(filePath); _waypoints = instance.Waypoints.ToDictionary(k => k.ID, v => v); _waypointsReverse = instance.Waypoints.ToDictionary(k => k, v => v.ID); _connections = _waypoints.ToDictionary(k => k.Value, v => new HashSet <DTOWaypoint>(v.Value.Paths.Select(p => _waypoints[p]))); Output("Read " + _waypoints.Count + " waypoints with " + _connections.Sum(c => c.Value.Count) + " connections!"); }
public static void HandleJenkinsCall(string[] args) { // On invalid arguments show info if (args.Length != CliArgs.Length) { Console.WriteLine("Usage: RAWSimO.CLI.exe " + string.Join(" ", CliArgs.Select(a => "<" + a.Item1 + ">"))); Console.WriteLine("Parameters:"); foreach (var item in CliArgs) { Console.WriteLine(item.Item1 + ": " + item.Item2); } Console.WriteLine("Actual call's arguments were: " + string.Join(" ", args)); return; } // Say hello Console.WriteLine("<<< Welcome to the RAWSimO Jenkins Handler >>>"); // Echo the arguments passed Console.WriteLine("Starting RAWSimO wrapper with the following arguments:"); for (int i = 0; i < CliArgs.Length; i++) { Console.WriteLine(CliArgs[i].Item1 + ": " + args[i]); } // Setup instance Console.Write("Initializing ... "); int seed = int.Parse(args[4]); string buildNumber = args[5]; Action <string> logAction = (string message) => { Console.WriteLine(message); }; Instance instance = InstanceIO.ReadInstance(args[0], args[1], args[2], logAction: logAction); instance.SettingConfig.LogAction = logAction; instance.SettingConfig.Seed = seed; instance.SettingConfig.StatisticsDirectory = Path.Combine(args[3], instance.Name + "-" + instance.SettingConfig.Name + "-" + instance.ControllerConfig.Name + "-" + instance.SettingConfig.Seed.ToString()); instance.Randomizer = new RandomizerSimple(seed); Console.WriteLine("Done!"); // Deus ex machina Console.WriteLine("Executing ... "); DateTime before = DateTime.Now; SimulationExecutor.Execute(instance); TimeSpan executionTime = DateTime.Now - before; Console.WriteLine("Simulation finished."); // Write short statistics to output instance.PrintStatistics((string s) => Console.WriteLine(s)); // Log the evaluation statistics AppendStatLine(instance, seed, buildNumber, executionTime); // Finished Console.WriteLine(".Fin. - SUCCESS"); }
public static void TestGenerateDefaultSimpleItemConfig() { SimpleItemGeneratorConfiguration config = OrderGenerator.GenerateSimpleItemConfiguration(new OrderGenerator.SimpleItemGeneratorPreConfiguration() { ItemDescriptionCount = 100, DefaultWeight = 1, DefaultCoWeight = 1, ProbabilityWeightNormalMu = 1, ProbabilityWeightNormalSigma = 3, ItemWeightLB = 1, ItemWeightUB = 7, ItemWeightMu = 2, ItemWeightSigma = 1, GivenCoWeights = 1 }); InstanceIO.WriteSimpleItemGeneratorConfigFile("simpleitemgeneratorconfig.xml", config); }
/// <summary> /// Plots the frequencies of a given item configuration file. /// </summary> /// <param name="filepath">The item configuration.</param> public static void PlotSimpleInventoryFrequencies(string filepath) { // Set group count int groupCount = 10; // Parse the given file Console.WriteLine("Parsing generator config ..."); SimpleItemGeneratorConfiguration config = InstanceIO.ReadSimpleItemGeneratorConfig(filepath); string outputBasename = config.Name; string frequencyFilename = config.Name; string directory = Path.GetDirectoryName(filepath); // Build frequency groups of the items Console.WriteLine("Building frequency groups ..."); int[] frequencyGroups = new int[groupCount]; double maxItemWeight = config.ItemWeights.Max(w => w.Value); bool plotWeights = config.ItemDescriptionWeights != null && config.ItemDescriptionWeights.Count > 0; List <double> weights = plotWeights ? config.ItemDescriptionWeights.Select(w => w.Value).OrderBy(w => w).ToList() : null; bool plotBundleSize = config.ItemDescriptionBundleSizes != null && config.ItemDescriptionBundleSizes.Count > 0; List <int> bundleSizes = plotBundleSize ? config.ItemDescriptionBundleSizes.Select(w => w.Value).OrderBy(w => w).ToList() : null; double overallWeight = config.ItemWeights.Sum(w => w.Value); List <double> probabilities = config.ItemWeights.Select(w => w.Value / overallWeight).OrderBy(p => p).ToList(); List <double> frequencies = config.ItemWeights.Select(w => w.Value / maxItemWeight).OrderBy(f => f).ToList(); List <double> frequenciesForGroupBuilding = frequencies.ToList(); for (int i = 0; i < frequencyGroups.Length; i++) { double groupFreqCap = (i + 1.0) / frequencyGroups.Length; int countInRange = frequenciesForGroupBuilding.TakeWhile(f => f <= groupFreqCap).Count(); frequencyGroups[i] = countInRange; frequenciesForGroupBuilding = frequenciesForGroupBuilding.Skip(countInRange).ToList(); } // Write data files Console.WriteLine("Generating plot data files ..."); // Write the data file for the group based plot string frequencyGroupsPlotDataFile = outputBasename + "groups.dat"; using (StreamWriter sw = new StreamWriter(Path.Combine(directory, frequencyGroupsPlotDataFile), false)) { sw.WriteLine(IOConstants.GNU_PLOT_COMMENT_LINE + " frequencyvalue groupcount"); for (int i = 0; i < frequencyGroups.Length; i++) { // Calculate x-value for group (use mid between lower and upper group boundaries) double groupXValue = (((double)i / frequencyGroups.Length)) + ((((double)(i + 1) / frequencyGroups.Length) - ((double)i / frequencyGroups.Length)) / 2.0); sw.WriteLine(groupXValue.ToString(IOConstants.FORMATTER) + IOConstants.GNU_PLOT_VALUE_SPLIT + frequencyGroups[i].ToString()); } } // Write the data file for a simple SKU/frequency plot string frequencySimplePlotDataFile = outputBasename + "simple.dat"; using (StreamWriter sw = new StreamWriter(Path.Combine(directory, frequencySimplePlotDataFile), false)) { sw.WriteLine(IOConstants.GNU_PLOT_COMMENT_LINE + " sku frequency"); // Write frequencies in reverse order int sku = 0; foreach (var freq in frequencies.OrderByDescending(f => f)) { // Update sku++; // Flush sw.WriteLine(sku.ToString() + IOConstants.GNU_PLOT_VALUE_SPLIT + freq.ToString(IOConstants.FORMATTER)); } } // Write the data file for a cumulative SKU/frequency plot string frequencyCumSimplePlotDataFile = outputBasename + "cumulative.dat"; using (StreamWriter sw = new StreamWriter(Path.Combine(directory, frequencyCumSimplePlotDataFile), false)) { sw.WriteLine(IOConstants.GNU_PLOT_COMMENT_LINE + " sku cum.frequency"); // Prepare frequency info double cumFrequency = 0; double overallFrequency = frequencies.Sum(); int sku = 0; // Aggregate and write cumulative frequencies starting with the largest foreach (var freq in frequencies.OrderByDescending(f => f)) { // Update sku++; cumFrequency += freq; // Flush sw.WriteLine(sku.ToString() + IOConstants.GNU_PLOT_VALUE_SPLIT + (cumFrequency / overallFrequency).ToString(IOConstants.FORMATTER)); } } // Write data file for the real probability plot string probabilityPlotDataFile = outputBasename + "probability.dat"; using (StreamWriter sw = new StreamWriter(Path.Combine(directory, probabilityPlotDataFile), false)) { sw.WriteLine(IOConstants.GNU_PLOT_COMMENT_LINE + " sku probability"); for (int i = 0; i < probabilities.Count; i++) { // Reverse order (start with the highest probability) sw.WriteLine((probabilities.Count - i).ToString() + IOConstants.GNU_PLOT_VALUE_SPLIT + probabilities[i].ToString(IOConstants.FORMATTER)); } } // Write data file for the item description weights plot string itemDescriptionWeightsPlotDataFile = outputBasename + "weights.dat"; if (plotWeights) { using (StreamWriter sw = new StreamWriter(Path.Combine(directory, itemDescriptionWeightsPlotDataFile), false)) { sw.WriteLine(IOConstants.GNU_PLOT_COMMENT_LINE + " sku weight"); for (int i = 0; i < weights.Count; i++) { // Write sw.WriteLine((i + 1).ToString() + IOConstants.GNU_PLOT_VALUE_SPLIT + weights[i].ToString(IOConstants.FORMATTER)); } } } // Write data file for the item description weights plot string itemDescriptionBundleSizesPlotDataFile = outputBasename + "bundlesizes.dat"; if (plotBundleSize) { using (StreamWriter sw = new StreamWriter(Path.Combine(directory, itemDescriptionBundleSizesPlotDataFile), false)) { sw.WriteLine(IOConstants.GNU_PLOT_COMMENT_LINE + " sku bundlesize"); for (int i = 0; i < bundleSizes.Count; i++) { // Write sw.WriteLine((i + 1).ToString() + IOConstants.GNU_PLOT_VALUE_SPLIT + bundleSizes[i].ToString(IOConstants.FORMATTER)); } } } // Generate plot script Console.WriteLine("Generating plot scipt ..."); string plotScriptName = outputBasename + ".gp"; using (StreamWriter sw = new StreamWriter(Path.Combine(directory, plotScriptName))) { sw.WriteLine("reset"); sw.WriteLine("# Output definition"); sw.WriteLine("set terminal pdfcairo enhanced size 7, 3 font \"Consolas, 12\""); sw.WriteLine("set lmargin 13"); sw.WriteLine("set rmargin 13"); sw.WriteLine("# Parameters"); sw.WriteLine("set key right top Right"); sw.WriteLine("set grid"); sw.WriteLine("set style fill solid 0.75"); sw.WriteLine("# Line-Styles"); sw.WriteLine("set style line 1 linetype 1 linecolor rgb \"" + PlotColoring.GetHexCode(PlotColors.MediumBlue) + "\" linewidth 1"); sw.WriteLine("set output \"" + frequencyFilename + ".pdf\""); sw.WriteLine("set title \"" + frequencyFilename + "\""); sw.WriteLine("set xlabel \"Frequency\""); sw.WriteLine("set ylabel \"SKU count\""); sw.WriteLine("plot \\"); sw.WriteLine("\"" + frequencyGroupsPlotDataFile + "\" u 1:2 w boxes linestyle 1 t \"SKU frequencies\""); sw.WriteLine("set title \"" + frequencyFilename + "\""); sw.WriteLine("set xlabel \"SKU\""); sw.WriteLine("set ylabel \"frequency\""); sw.WriteLine("plot \\"); sw.WriteLine("\"" + frequencySimplePlotDataFile + "\" u 1:2 w steps linestyle 1 t \"SKU frequencies\""); sw.WriteLine("set title \"" + frequencyFilename + "\""); sw.WriteLine("set xlabel \"SKU\""); sw.WriteLine("set ylabel \"rel. cum. frequency\""); sw.WriteLine("plot \\"); sw.WriteLine("\"" + frequencyCumSimplePlotDataFile + "\" u 1:2 w steps linestyle 1 t \"cum. SKU frequencies\""); sw.WriteLine("set title \"" + frequencyFilename + "\""); sw.WriteLine("set xlabel \"SKU\""); sw.WriteLine("set ylabel \"probability\""); sw.WriteLine("plot \\"); sw.WriteLine("\"" + probabilityPlotDataFile + "\" u 1:2 w steps linestyle 1 t \"SKU probabilities\""); if (plotWeights) { sw.WriteLine("set title \"" + frequencyFilename + "\""); sw.WriteLine("set xlabel \"SKU\""); sw.WriteLine("set ylabel \"size\""); sw.WriteLine("plot \\"); sw.WriteLine("\"" + itemDescriptionWeightsPlotDataFile + "\" u 1:2 w steps linestyle 1 t \"SKU size\""); } if (plotBundleSize) { sw.WriteLine("set title \"" + frequencyFilename + "\""); sw.WriteLine("set xlabel \"SKU\""); sw.WriteLine("set ylabel \"units\""); sw.WriteLine("plot \\"); sw.WriteLine("\"" + itemDescriptionBundleSizesPlotDataFile + "\" u 1:2 w steps linestyle 1 t \"SKU replenishment order size\""); } sw.WriteLine("reset"); sw.WriteLine("exit"); } string commandScriptName = outputBasename + ".cmd"; using (StreamWriter sw = new StreamWriter(Path.Combine(directory, commandScriptName))) { sw.WriteLine("gnuplot " + plotScriptName); } // Log Console.WriteLine("Calling plot script ..."); // Execute plot script DataProcessor.ExecuteScript(Path.Combine(directory, commandScriptName), (string msg) => { Console.WriteLine(msg); }); }
public static void GenerateRepositioningSet3() { Dictionary <bool, StationActivationConfiguration> stationControllers = new Dictionary <bool, StationActivationConfiguration>() { { false, new ActivateAllStationActivationConfiguration() }, { true, new WorkShiftStationActivationConfiguration(new DefaultConstructorIdentificationClass()) }, }; List <Tuple <double, double> > speedUtilityWeights = new List <Tuple <double, double> >() { new Tuple <double, double>(0, 1), new Tuple <double, double>(1, 0), new Tuple <double, double>(1, 1), }; List <Tuple <PodStorageConfiguration, RepositioningConfiguration> > positioningControllers = new List <Tuple <PodStorageConfiguration, RepositioningConfiguration> >() { new Tuple <PodStorageConfiguration, RepositioningConfiguration>( new NearestPodStorageConfiguration(), new UtilityRepositioningConfiguration()), new Tuple <PodStorageConfiguration, RepositioningConfiguration>( new NearestPodStorageConfiguration(), new CacheDropoffRepositioningConfiguration()), new Tuple <PodStorageConfiguration, RepositioningConfiguration>( new UtilityPodStorageConfiguration(), new UtilityRepositioningConfiguration()), new Tuple <PodStorageConfiguration, RepositioningConfiguration>( new CachePodStorageConfiguration(), new CacheDropoffRepositioningConfiguration()), }; List <OrderBatchingConfiguration> orderBatchers = new List <OrderBatchingConfiguration>() { new DefaultOrderBatchingConfiguration() { OrderSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOrderSelection.FCFS, StationSelectionRule = Core.Control.Defaults.OrderBatching.DefaultOutputStationSelection.Random, }, }; List <RepositioningSubExperiment> subExperiments = new List <RepositioningSubExperiment>() { new RepositioningSubExperiment() { NightDown = false, BotsPerOStation = 4, BotAllocation = new Tuple <bool, double, double, double>(false, 1, 3, 0) }, new RepositioningSubExperiment() { NightDown = false, BotsPerOStation = 4, BotAllocation = new Tuple <bool, double, double, double>(true, 1, 2, 1) }, new RepositioningSubExperiment() { NightDown = false, BotsPerOStation = 5, BotAllocation = new Tuple <bool, double, double, double>(true, 1, 3, 1) }, new RepositioningSubExperiment() { NightDown = true, BotsPerOStation = 4, BotAllocation = new Tuple <bool, double, double, double>(true, 1, 3, 0) }, new RepositioningSubExperiment() { NightDown = true, BotsPerOStation = 4, BotAllocation = new Tuple <bool, double, double, double>(false, 1, 3, 0) }, }; int counter = 0; foreach (var subExperiment in subExperiments) { string dir = "SubExp" + (++counter); while (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } foreach (var speedUtilityWeight in speedUtilityWeights) { foreach (var positioningController in positioningControllers) { foreach (var orderBatcher in orderBatchers) { // Prepare setting SettingConfiguration setting = GetRepositioningBaseSetting(); setting.OverrideConfig = new OverrideConfiguration() { OverrideBotCountPerOStation = true, OverrideBotCountPerOStationValue = subExperiment.BotsPerOStation, }; if (subExperiment.NightDown) { setting.InventoryConfiguration.DemandInventoryConfiguration.BundleCount = 0; setting.InventoryConfiguration.SubmitBatches = true; setting.InventoryConfiguration.BatchInventoryConfiguration = new BatchInventoryConfiguration() { MaxTimeForBundleSubmissions = TimeSpan.FromDays(1).TotalSeconds, MaxTimeForOrderSubmissions = TimeSpan.FromDays(1).TotalSeconds, BundleBatches = new List <Skvp <double, double> >() { new Skvp <double, double>() { Key = TimeSpan.FromHours(16).TotalSeconds, Value = 0.75 } }, OrderBatches = new List <Skvp <double, int> >() { new Skvp <double, int>() { Key = TimeSpan.FromHours(22).TotalSeconds, Value = 1500 } }, }; } // Prepare config ControlConfiguration config = new ControlConfiguration() { StationActivationConfig = stationControllers[subExperiment.NightDown], TaskAllocationConfig = new BalancedTaskAllocationConfiguration() { RepositionBeforeRest = subExperiment.BotAllocation.Item1, WeightInputStations = subExperiment.BotAllocation.Item2, WeightOutputStations = subExperiment.BotAllocation.Item3, WeightRepositioning = subExperiment.BotAllocation.Item4, }, OrderBatchingConfig = orderBatcher, PodStorageConfig = positioningController.Item1, RepositioningConfig = positioningController.Item2, }; // Set weights if (config.PodStorageConfig is CachePodStorageConfiguration) { (config.PodStorageConfig as CachePodStorageConfiguration).WeightSpeed = speedUtilityWeight.Item1; (config.PodStorageConfig as CachePodStorageConfiguration).WeightUtility = speedUtilityWeight.Item2; } if (config.PodStorageConfig is UtilityPodStorageConfiguration) { (config.PodStorageConfig as UtilityPodStorageConfiguration).UtilityConfig.WeightSpeed = speedUtilityWeight.Item1; (config.PodStorageConfig as UtilityPodStorageConfiguration).UtilityConfig.WeightUtility = speedUtilityWeight.Item2; } if (config.RepositioningConfig is CacheDropoffRepositioningConfiguration) { (config.RepositioningConfig as CacheDropoffRepositioningConfiguration).WeightSpeed = speedUtilityWeight.Item1; (config.RepositioningConfig as CacheDropoffRepositioningConfiguration).WeightUtility = speedUtilityWeight.Item2; } if (config.RepositioningConfig is UtilityRepositioningConfiguration) { (config.RepositioningConfig as UtilityRepositioningConfiguration).UtilityConfig.WeightSpeed = speedUtilityWeight.Item1; (config.RepositioningConfig as UtilityRepositioningConfiguration).UtilityConfig.WeightUtility = speedUtilityWeight.Item2; } // Name setting setting.Name = "ScenRep-" + (subExperiment.NightDown ? "NightDown" : "NoDown") + "-BPOS" + subExperiment.BotsPerOStation; // Name controller string saTag; if (config.StationActivationConfig is ActivateAllStationActivationConfiguration) { saTag = "A"; } else if (config.StationActivationConfig is WorkShiftStationActivationConfiguration) { saTag = "W"; } else { throw new ArgumentException("Unknown!"); } string psTag; if (config.PodStorageConfig is RandomPodStorageConfiguration) { psTag = "R"; } else if (config.PodStorageConfig is NearestPodStorageConfiguration) { psTag = "N"; } else if (config.PodStorageConfig is CachePodStorageConfiguration) { psTag = "C"; } else if (config.PodStorageConfig is UtilityPodStorageConfiguration) { psTag = "U"; } else { throw new ArgumentException("Unknown!"); } string rpTag; if (config.RepositioningConfig is DummyRepositioningConfiguration) { rpTag = "D"; } else if (config.RepositioningConfig is CacheDropoffRepositioningConfiguration) { rpTag = "C"; } else if (config.RepositioningConfig is UtilityRepositioningConfiguration) { rpTag = "U"; } else { throw new ArgumentException("Unknown!"); } string obTag; if (config.OrderBatchingConfig is QueueOrderBatchingConfiguration) { obTag = "Q"; } else if (config.OrderBatchingConfig is PodMatchingOrderBatchingConfiguration) { obTag = "M"; } else if (config.OrderBatchingConfig is DefaultOrderBatchingConfiguration) { obTag = "D"; } else { throw new ArgumentException("Unknown!"); } config.Name = "PS" + psTag + "-" + "RP" + rpTag + "-" + "SA" + saTag + "-" + "OB" + obTag + "-" + "Bot" + (subExperiment.BotAllocation.Item1 ? "t" : "f") + "I" + subExperiment.BotAllocation.Item2 + "O" + subExperiment.BotAllocation.Item3 + "R" + subExperiment.BotAllocation.Item4 + "-" + "Wei" + speedUtilityWeight.Item1.ToString(IOConstants.EXPORT_FORMAT_SHORTER, IOConstants.FORMATTER) + speedUtilityWeight.Item2.ToString(IOConstants.EXPORT_FORMAT_SHORTER, IOConstants.FORMATTER); // Save it string fileNameController = Path.Combine(dir, config.Name + ".xconf"); Console.WriteLine("Saving " + fileNameController + " ..."); InstanceIO.WriteConfiguration(fileNameController, config); string fileNameSetting = Path.Combine(dir, setting.Name + ".xsett"); Console.WriteLine("Saving " + fileNameSetting + " ..."); InstanceIO.WriteSetting(fileNameSetting, setting); } } } } }
public static void GenerateRotterdamPhase2Settings() { // --> Begin Console.WriteLine("Initializing ..."); Dictionary <string, string> skuFiles = new Dictionary <string, string> { { "Mu-1000.xgenc", "1000" }, { "Mu-10000.xgenc", "10000" }, }; List <int> orderSizeScenarios = new List <int> { 1, 2, 3 }; List <double> returnOrderProbabilities = new List <double> { 0, 0.3 }; //List<int> pickStationCapacities = new List<int> { 6, 12, 18 }; List <double> pickStationCounts = new List <double> { 1.0 / 6.0, 2.0 / 6.0, 3.0 / 6.0, 4.0 / 6.0, 5.0 / 6.0, 6.0 / 6.0, }; //List<double> replStationCounts = new List<double> { 1.0 / 3.0, 2.0 / 3.0, 1.0 }; List <int> botsPerStations = new List <int> { 2, 3, 4, 5, 6 }; // Build all combinations foreach (var botsPerStation in botsPerStations) { foreach (var skuFile in skuFiles) { foreach (var pickStationCount in pickStationCounts) { foreach (var orderSizeScenario in orderSizeScenarios) { foreach (var returnOrderProbability in returnOrderProbabilities) { SettingConfiguration setting = GetRotterdamBaseSetting(); setting.OverrideConfig = new OverrideConfiguration() { OverrideBotCountPerOStation = true, OverrideBotCountPerOStationValue = botsPerStation, OverrideOutputStationCapacity = true, OverrideOutputStationCapacityValue = 8, OverrideInputStationCount = true, OverrideInputStationCountValue = 2.0 / 6.0, OverrideOutputStationCount = true, OverrideOutputStationCountValue = pickStationCount, }; setting.InventoryConfiguration.SimpleItemConfiguration.GeneratorConfigFile = skuFile.Key; switch (orderSizeScenario) { case 1: /* Do nothing - default scenario */ break; case 2: setting.InventoryConfiguration.OrderPositionCountMin = 1; setting.InventoryConfiguration.OrderPositionCountMax = 1; setting.InventoryConfiguration.PositionCountMin = 1; setting.InventoryConfiguration.PositionCountMax = 1; break; case 3: setting.InventoryConfiguration.OrderPositionCountMin = 2; setting.InventoryConfiguration.PositionCountMin = 2; break; default: throw new ArgumentException("Unknown order size scenario: " + orderSizeScenario); } setting.InventoryConfiguration.ReturnOrderProbability = returnOrderProbability; setting.CommentTag1 = "Scen" + "-SKU" + skuFile.Value + "-O" + (orderSizeScenario == 1 ? "M" : (orderSizeScenario == 2 ? "S" : "L")) + "-RO" + (returnOrderProbability > 0 ? "t" : "f"); string name = "MaTi" + "-SKU" + skuFile.Value + "-O" + (orderSizeScenario == 1 ? "M" : (orderSizeScenario == 2 ? "S" : "L")) + "-RO" + (returnOrderProbability > 0 ? "t" : "f") + "-BPOS" + botsPerStation.ToString(IOConstants.EXPORT_FORMAT_SHORTEST_BY_ROUNDING, IOConstants.FORMATTER) + //"-C" + pickStationCapacity.ToString(IOConstants.FORMATTER) + "-P" + pickStationCount.ToString(IOConstants.EXPORT_FORMAT_SHORTER, IOConstants.FORMATTER) + //"-R" + replStationCount.ToString(IOConstants.EXPORT_FORMAT_SHORTER, IOConstants.FORMATTER) + ""; setting.Name = name; string fileName = setting.Name + ".xsett"; Console.WriteLine("Saving " + fileName + " ..."); InstanceIO.WriteSetting(fileName, setting); } } } } } }
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; } } }
public static void Main(string[] args) { // On invalid arguments show info if (args.Length < CliArgs.Length || args.Length > CliArgs.Length + 1) { LogLine("Usage: RAWSimO.CLI.exe " + string.Join(" ", CliArgs.Select(a => "<" + a.Item1 + ">"))); LogLine("Parameters:"); foreach (var item in CliArgs) { LogLine(item.Item1 + ": " + item.Item2); } LogLine("Actual call's arguments were: " + string.Join(" ", args)); LogLine("Note: you may add one additional and last argument as a tag"); return; } // Say hello LogLine("<<< Welcome to the RAWSimO CLI >>>"); LogLine("The time is: " + DateTime.Now.ToString(IOConstants.FORMATTER)); // Echo the arguments passed LogLine("Starting RAWSimO wrapper with the following arguments:"); for (int i = 0; i < CliArgs.Length; i++) { LogLine(CliArgs[i].Item1 + ": " + args[i]); } // Check for tag argument if (args.Length == CliArgs.Length + 1) { LogLine("Additionally the following tag was passed: " + args[CliArgs.Length]); } // Catch unhandled exceptions if (!AppDomain.CurrentDomain.FriendlyName.EndsWith("vshost.exe")) { LogLine("Adding handler for unhandled exceptions ..."); var handler = new UnhandledExceptionHandler() { Instance = args[0], SettingConfig = args[1], ControlConfig = args[2], Seed = args[4], LogAction = LogLine, Tag = ((args.Length == CliArgs.Length + 1) ? args[CliArgs.Length] : null) }; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(handler.LogUnhandledException); } // Setup instance LogLine("Initializing ... "); int seed = int.Parse(args[4]); LogLine("Bug is here."); Action <string> logAction = (string message) => { LogLine(message); }; Instance instance = InstanceIO.ReadInstance(args[0], args[1], args[2], logAction: logAction); instance.SettingConfig.LogAction = logAction; instance.SettingConfig.Seed = seed; if (args.Length == CliArgs.Length + 1) { instance.Tag = args[CliArgs.Length]; } string statisticsFolder = instance.Name + "-" + instance.SettingConfig.Name + "-" + instance.ControllerConfig.Name + "-" + instance.SettingConfig.Seed.ToString(); instance.SettingConfig.StatisticsDirectory = Path.Combine(args[3], statisticsFolder); LogLine("StatisticsFolder: " + statisticsFolder); instance.Randomizer = new RandomizerSimple(seed); LogLine("Done!"); // Setup log to disk if (!Directory.Exists(instance.SettingConfig.StatisticsDirectory)) { Directory.CreateDirectory(instance.SettingConfig.StatisticsDirectory); } _logWriter = new StreamWriter(Path.Combine(instance.SettingConfig.StatisticsDirectory, IOConstants.LOG_FILE), false) { AutoFlush = true }; // Deus ex machina LogLine("Executing ... "); SimulationExecutor.Execute(instance); LogLine("Simulation finished."); // Write short statistics to output instance.PrintStatistics((string s) => LogLine(s)); // Mark tag as finished, if available if (instance.Tag != null) { MarkTagFinished(args[3], args[0], args[1], args[2], args[4], instance.Tag); } // Finished LogLine(".Fin. - SUCCESS"); }
/// <summary> /// Updates the element to the specified time. /// </summary> /// <param name="lastTime">The time before the update.</param> /// <param name="currentTime">The time to update to.</param> public void Update(double lastTime, double currentTime) { if (_potentialCrashBots.Any()) { // Remember whether there was a collision overall bool anyCollision = false; // Check all bots that sensed a potential collision foreach (var crashBot in _potentialCrashBots) { // Log the potential collision _instance.LogInfo("Investigating potential collision of " + crashBot.GetIdentfierString() + " ..."); // Check quad-tree for collisions (consider the pod too) if (// Check for collisions with other bots crashBot.Tier.BotQuadTree.IsCollision(crashBot) || // Check for collisions with the tier boundaries (crashBot.X - crashBot.Radius < 0 || crashBot.X + crashBot.Radius > crashBot.Tier.Length || crashBot.Y - crashBot.Radius < 0 || crashBot.Y + crashBot.Radius > crashBot.Tier.Width) || // Check for collisions with other pods (crashBot.Pod != null && crashBot.Pod.Tier.PodQuadTree.IsCollision(crashBot.Pod))) { // Remember that we have a collision anyCollision = true; // ---> Debug: Log info about the crash pilot _instance.LogSevere("Bot" + crashBot.ID.ToString() + " crashed! Information:"); _instance.LogSevere( " X: " + crashBot.X.ToString(IOConstants.FORMATTER) + " Y: " + crashBot.Y.ToString(IOConstants.FORMATTER) + " Radius: " + crashBot.Radius.ToString(IOConstants.FORMATTER) + " Orientation: " + crashBot.Orientation.ToString(IOConstants.FORMATTER) + " Bucket: " + (crashBot.Pod != null ? crashBot.Pod.ID.ToString() : " <null>")); // Check multiple radii for other bots and pods for (int i = 2; i < 5; i++) { _instance.LogSevere("Potential crash partners (bots) within " + i.ToString() + " * radius:"); foreach (var potentialCrashBot in _instance.Compound.BotCurrentTier[crashBot].GetBotsWithinDistance(crashBot.X, crashBot.Y, i * crashBot.Radius).Where(b => b != crashBot)) { _instance.LogSevere( "Bot: " + potentialCrashBot.ID.ToString() + " X: " + potentialCrashBot.X.ToString(IOConstants.FORMATTER) + " Y: " + potentialCrashBot.Y.ToString(IOConstants.FORMATTER) + " Orientation: " + potentialCrashBot.Orientation.ToString(IOConstants.FORMATTER)); } _instance.LogSevere("Potential crash partners (pods) within " + i.ToString() + " * radius:"); foreach (var potentialCrashPod in _instance.Compound.BotCurrentTier[crashBot].GetPodsWithinDistance(crashBot.X, crashBot.Y, i * crashBot.Radius).Where(p => p != crashBot.Pod)) { _instance.LogSevere( "Pod: " + potentialCrashPod.ID.ToString() + " X: " + potentialCrashPod.X.ToString(IOConstants.FORMATTER) + " Y: " + potentialCrashPod.Y.ToString(IOConstants.FORMATTER) + " Orientation: " + potentialCrashPod.Orientation.ToString(IOConstants.FORMATTER)); } } } } // Handle collision, if there was one if (anyCollision) { // Save instance string debugInstanceFile = System.IO.Path.Combine(_instance.SettingConfig.StatisticsDirectory, "debug.xinst"); _instance.LogSevere("Logging snapshot of crash situation to " + debugInstanceFile + " ..."); InstanceIO.WriteInstance(debugInstanceFile, _instance); _instance.LogSevere("We're done here!"); // This is not allowed anymore throw new Exception("Unmanaged Operation: collisions are not expected anymore!"); } else { // There was no collision at all - we can clear the potential crash bots _potentialCrashBots.Clear(); } } }
internal static void GenerateRotterdamMark2Set() { // --> Begin Console.WriteLine("Initializing ..."); // SKUs List <string> skuScenarios = new List <string> { // 100 SKUs "Mu-100.xgenc", // 500 SKUs "Mu-500.xgenc", // 1000 SKUs "Mu-1000.xgenc", }; // BotsPerOStation List <int> botsPerOStationCounts = new List <int> { // 2 bots per output station 2, // 4 bots per output station 4, // 6 bots per output station 6, // 8 bots per output station 8, }; // OStationCapacity List <int> oStationCapacities = new List <int> { // 6 orders in parallel 6, // 12 orders in parallel 12, // 18 orders in parallel 18, }; // ReplenishmentStations List <double> iStationAmounts = new List <double> { // Use only one (the override will always save the last station) 0, // Use only 50 % 0.5, // Use all 1, }; // --> Generate the settings Console.WriteLine("Generating all settings ..."); List <SettingConfiguration> settings = new List <SettingConfiguration>(); foreach (var skuScenario in skuScenarios) { foreach (var botsPerOStationCount in botsPerOStationCounts) { foreach (var oStationCapacity in oStationCapacities) { foreach (var iStationAmount in iStationAmounts) { settings.Add(new SettingConfiguration() { Name = "Mu" + "-SKU" + skuScenario.Replace("Mu-", "").Replace(".xgenc", "") + "-B" + botsPerOStationCount + "-O" + oStationCapacity + "-I" + iStationAmount.ToString(IOConstants.FORMATTER), SimulationWarmupTime = 0, SimulationDuration = 86400, InventoryConfiguration = new InventoryConfiguration() { ItemType = Core.Items.ItemType.SimpleItem, OrderMode = Core.Management.OrderMode.Fill, InitialInventory = 0.7, WarmupOrderCount = 5000, // Specify item weight and bundle size (though they will be overriden by the simple item config) ItemWeightMin = 2, ItemWeightMax = 8, BundleSizeMin = 4, BundleSizeMax = 12, // Lines per order OrderPositionCountMean = 1, OrderPositionCountStdDev = 1, OrderPositionCountMin = 1, OrderPositionCountMax = 4, // Units per order line PositionCountMean = 1, PositionCountStdDev = 0.3, PositionCountMin = 1, PositionCountMax = 3, // Further demand / fill mode settings DemandInventoryConfiguration = new DemandInventoryConfiguration() { OrderCount = 200, BundleCount = 200, InventoryLevelDrivenBundleGeneration = true, InventoryLevelBundleStopThreshold = 0.85, InventoryLevelBundleRestartThreshold = 0.65, InventoryLevelDrivenOrderGeneration = true, InventoryLevelOrderStopThreshold = 0.1, InventoryLevelOrderRestartThreshold = 0.6, }, // Simple item scenario SimpleItemConfiguration = new SimpleItemConfiguration() { GeneratorConfigFile = skuScenario }, }, // Override values OverrideConfig = new OverrideConfiguration() { OverrideInputStationCount = true, OverrideInputStationCountValue = iStationAmount, OverrideOutputStationCapacity = true, OverrideOutputStationCapacityValue = oStationCapacity, OverrideBotCountPerOStation = true, OverrideBotCountPerOStationValue = botsPerOStationCount, } }); } } } } // --> Save configurations Console.WriteLine("Writing all settings ..."); foreach (var config in settings) { // Save string fileName = config.Name + ".xsett"; Console.WriteLine("Saving " + fileName + " ..."); InstanceIO.WriteSetting(fileName, config); } }