Beispiel #1
0
 public void Generate()
 {
     Console.WriteLine("Generating Entries...");
     for (int i = 1; i <= Generations; i++)
     {
         int entriesCount = CalculateEntries(i);
         var data         = _factory.GenerateEntries(entriesCount);
         foreach (var manager in _managers)
         {
             manager.Write(data, i.ToString());
         }
     }
 }
Beispiel #2
0
        public void Run(decimal budget)
        {
            for (int i = 1; i <= Generations; i++)
            {
                int entriesCount = CalculateEntries(i);
                Console.WriteLine($"Entries: {entriesCount}");
                var data = _factory.GenerateEntries(entriesCount);

                GC.Collect();
                GC.WaitForPendingFinalizers();

                var sw = new Stopwatch();
                sw.Start();
                var result = Optimiser.FindMaxScore(data, budget);
                sw.Stop();

                Console.WriteLine($"Solution found in {sw.ElapsedMilliseconds.ToString()}ms");
                Console.WriteLine($"Total efficiency: {result.Item1}");
                Console.WriteLine($"Total price: {result.Item2}");
                Console.WriteLine($"Leftover: {budget - result.Item2}");
                System.Console.WriteLine();
            }
        }