private static void GenerateFromExistingPlans(int seqLen, string folder, string suffix) { var futureGenerator = new FutureProductionPlanGenerator(0.5) { ProbabilityOfStartingInMqbState = 0.5, SequenceLength = seqLen }; var probabilities = File.ReadAllLines("probability_log.txt").Select(t => t.Split(';')).Select(t => t[3]).Skip(1).Select(double.Parse).ToArray(); var loaderFiles = Directory.GetDirectories("GeneratedInput", "generated_situation*") .Select(Directory.GetFiles) .Select(t => { return(new ProductionScenarioPaths() { FutureProductionListCsv = t.FirstOrDefault(s => s.Contains("Future")), HistoricalProductionListCsv = t.FirstOrDefault(s => s.Contains("Historical")), WarehouseInitialStateCsv = t.FirstOrDefault(s => s.Contains("Warehouse")) }); }) .ToList(); var loader = new ProductionStateLoader(loaderFiles, "GeneratedInput/ProcessingTimeMatrix.csv"); for (int i = 0; i < loader.DefaultScenariosInMemory.Count; i++) { var state = loader.LoadScenarioFromMemory(i); futureGenerator.MqbToMebTransitionProbability = probabilities[i]; var seq = futureGenerator.GenerateSequence(); state.FutureProductionPlan = new Queue <ItemState>(seq); state.SaveProductionState(folder, $"{suffix}{i}"); Console.WriteLine($"Processed: {i}"); } }
public void TestFutureProductionPlanGenerator(double proba, int expected) { var generator = new FutureProductionPlanGenerator(proba) { ProbabilityOfStartingInMqbState = 1.0, SequenceLength = 100 }; var sequence = generator.GenerateSequence(); Assert.AreEqual(expected, sequence.Count(t => t == ItemState.MQB)); }