Exemple #1
0
        static void Main(string[] args)
        {
            Stopwatch       sw            = Stopwatch.StartNew();
            List <Instance> instancesList = new List <Instance>();

            for (int i = 1; i < 11; i++)
            {
                instancesList.Add(InputService.Parse(i));
            }
            sw.Stop();

            for (int i = 0; i < instancesList.Count; i++)
            {
                currentInstance = instancesList[i];
                instanceNumber  = i + 1;

                timerOneMinute           = new Timer();
                timerOneMinute.Interval  = 60000 - sw.ElapsedMilliseconds;
                timerOneMinute.AutoReset = false;
                timerOneMinute.Elapsed  += new ElapsedEventHandler(TimerElapsedOneMinute);
                timerOneMinute.Start();

                timerFiveMinutes           = new Timer();
                timerFiveMinutes.Interval  = 300000 - sw.ElapsedMilliseconds;
                timerFiveMinutes.AutoReset = false;
                timerFiveMinutes.Elapsed  += new ElapsedEventHandler(TimerElapsedFiveMinutes);
                timerFiveMinutes.Start();


                var clusterer     = new RadiusCluster();
                var resultCluster = clusterer.Cluster(instancesList[0]);

                Solution initialSolution = InitialSolution.Find(resultCluster, instancesList[i].Capacity);
                currentSolution = initialSolution;

                do
                {
                    //simulated annealing(solution)
                } while (true); //dok nije gotov algoritam

                var test = new Algorithms.GurobiExample();

                OutputService.OutputSolution(currentSolution, instanceNumber, "ne", (int)currentInstance.Students);
                timerOneMinute.Dispose();
                timerFiveMinutes.Dispose();
            }
        }
Exemple #2
0
 public static void TimerElapsedFiveMinutes(object sender, EventArgs e)
 {
     OutputService.OutputSolution(currentSolution, instanceNumber, "5m", (int)currentInstance.Students);
 }