static void Main(string[] args) { //Expensive(); //Genetic(); while (true) { List <Client> clients; List <Manufacture> manufactures; // f.ReadFromFile(out clients, out manufactures); GenerateInput.Generate(out clients, out manufactures); Expensive(manufactures, clients); var result = Frequancy(manufactures); Console.WriteLine("Frequancy: " + result.Adaptability); var result2 = Genetic(manufactures); Console.WriteLine("Genertic: " + result2.Adaptability); var result3 = Expensive(manufactures, clients); Console.WriteLine("Greedy: " + result3); Console.WriteLine("------------------------"); Thread.Sleep(3000); } Console.ReadKey(); }
private void DrawGraph_Click(object sender, EventArgs e) { if (Validate()) { this.Chart.Series["Frequancy"].Points.Clear(); List <Client> clients = new List <Client>(); List <Manufacture> manufactures = new List <Manufacture>(); GenerateInput.Generate(out clients, out manufactures); manufactures = ProbabilityComputerer.Compute(manufactures); List <int> timesOfTask = new List <int>(); for (int i = 10; i <= 100; i += 10) { timesOfTask.Clear(); for (int j = 0; j < taskTimesCount; j++) { var unit = FrequancySearch.FindMostFrequance(manufactures, 100, i); timesOfTask.Add(unit.Adaptability); } this.Chart.Series["Frequancy"].Points.AddXY(i, timesOfTask.Average()); } } else { MessageBox.Show("Перевірте введені дані"); } }
private void TimeExecutionXYGenerator(GenerateDataPoint dataPoint, int clientCount) { List <Manufacture> manufactures; List <Client> clients; GenerateInput.Generate(out clients, out manufactures, clientCount); List <double> geneticResult = new List <double>(); List <double> greedyResult = new List <double>(); List <double> frequancyResult = new List <double>(); Stopwatch stopwatch = new Stopwatch(); for (int j = 0; j < numberOfTestForOneStep; j++) { //Genetic stopwatch.Reset(); stopwatch.Start(); GenerateGenetic(manufactures); stopwatch.Stop(); geneticResult.Add(stopwatch.ElapsedMilliseconds); //Greedy stopwatch.Reset(); stopwatch.Start(); GenerateGreedy(manufactures, clients); stopwatch.Stop(); greedyResult.Add(stopwatch.ElapsedMilliseconds); //Frequancy stopwatch.Reset(); stopwatch.Start(); GenerateFrequancy(manufactures); stopwatch.Stop(); frequancyResult.Add(stopwatch.ElapsedMilliseconds); } dataPoint.GeneticData.Add(new DoublePoint(clientCount, geneticResult.Average())); dataPoint.GreedyData.Add(new DoublePoint(clientCount, greedyResult.Average())); dataPoint.FrequancyData.Add(new DoublePoint(clientCount, frequancyResult.Average())); //this.SizeGraph.Series[geneticName].Points.AddXY(clientCount, geneticResult.Average()); //this.SizeGraph.Series[greedyName].Points.AddXY(clientCount, greedyResult.Average()); //this.SizeGraph.Series[frequancyName].Points.AddXY(clientCount, frequancyResult.Average()); }
private void PointXYGenerate(GenerateDataPoint dataPoint, int clientCount) { List <Manufacture> manufactures; List <Client> clients; GenerateInput.Generate(out clients, out manufactures, clientCount); List <int> geneticResult = new List <int>(); List <int> greedyResult = new List <int>(); List <int> frequancyResult = new List <int>(); for (int j = 0; j < numberOfTestForOneStep; j++) { geneticResult.Add(GenerateGenetic(manufactures)); greedyResult.Add(GenerateGreedy(manufactures, clients)); frequancyResult.Add(GenerateFrequancy(manufactures)); } dataPoint.GeneticData.Add(new DoublePoint(clientCount, geneticResult.Average())); dataPoint.GreedyData.Add(new DoublePoint(clientCount, greedyResult.Average())); dataPoint.FrequancyData.Add(new DoublePoint(clientCount, frequancyResult.Average())); //this.SizeGraph.Series[geneticName].Points.AddXY(clientCount, geneticResult.Average()); //this.SizeGraph.Series[greedyName].Points.AddXY(clientCount, greedyResult.Average()); //this.SizeGraph.Series[frequancyName].Points.AddXY(clientCount, frequancyResult.Average()); }