Esempio n. 1
0
        private static void GenerateLocalSolverTuningDatasets()
        {
            var generator = new DatasetGenerator(4000,
                                                 4000,
                                                 15,
                                                 2,
                                                 2,
                                                 new[] { 4, 4 },
                                                 new[] { 2, 4 },
                                                 -1,
                                                 true,
                                                 "IRuettae.Tuning.LocalSolverGridSearch.DataSets",
                                                 "OptimizationDataSets"
                                                 );

            for (int i = 0; i < 20; i++)
            {
                File.WriteAllText($"OptimizationDataSets.DataSetFifteen{i}.cs", generator.Generate($"DataSetFifteen{i}"));
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //GenerateLocalSolverTuningDatasets();
            //GenerateAllDatasets();
            GenerateUnavailableDesiredImpactDataSets();
            BigHr();
            Console.WriteLine("Program written to generate code for different datasets.");
            Console.WriteLine();

            Console.WriteLine("Please input only correct values, no exception handling here!");
            SmallHr();

            Console.Write("Map-Width [number]: ");
            int width = int.Parse(Console.ReadLine());

            Console.Write("Map-Height [number]: ");
            int height = int.Parse(Console.ReadLine());

            Console.Write("Visits [number]: ");
            int numberOfVisits = int.Parse(Console.ReadLine());

            Console.Write("Days [number]: ");
            int numberOfDays = int.Parse(Console.ReadLine());

            Console.Write("Santas [number]: ");
            int numberOfSantas = int.Parse(Console.ReadLine());
            var desired        = new int[numberOfDays];

            for (int i = 0; i < numberOfDays; i++)
            {
                Console.Write($"Number of visits desired on day {i} [number]: ");
                desired[i] = int.Parse(Console.ReadLine());
            }

            var unavailable = new int[numberOfDays];

            for (int i = 0; i < numberOfDays; i++)
            {
                Console.Write($"Number of visits unavailable on day {i} [number]: ");
                unavailable[i] = int.Parse(Console.ReadLine());
            }

            Console.Write("Fixed working day duration (empty = gets calculated): ");
            var workingDayDurationInput = Console.ReadLine();
            int workingDayDuration      = string.IsNullOrWhiteSpace(workingDayDurationInput)
                ? -1
                : int.Parse(workingDayDurationInput);

            Console.Write("Generate breaks (empty = false): ");
            var  generateBreaksInput = Console.ReadLine();
            bool generateBreaks      = !string.IsNullOrWhiteSpace(generateBreaksInput) && bool.Parse(generateBreaksInput);

            Console.Write("Method name [text]: ");
            var methodName = Console.ReadLine();

            Console.WriteLine();
            Console.WriteLine("Calculating...");
            BigHr();
            var output =
                new DatasetGenerator(width, height, numberOfVisits, numberOfDays, numberOfSantas, desired, unavailable, workingDayDuration, generateBreaks)
                .Generate(methodName);

            //Console.WriteLine(output);
            BigHr();

            File.WriteAllText($"DatasetFactory.{methodName}.cs", output);

            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }