Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace GeneticAlgorithm_cs
- {
- class GreedyAlgorithm
- {
- private int color = 0;
- private Count count;
- private List<int> colorsList = new List<int>();
- public GreedyAlgorithm(Count c)
- {
- count = c;
- for(int i = 0; i < Parameters.gensQuantity; i++)
- {
- colorsList.Add(-1);
- }
- colorsList[0] = 0;
- }
- public void Start()
- {
- for(int i = 0; i < Parameters.gensQuantity; i++)
- {
- colorsList[i] = 0;
- color = 0;
- for (int j = 1; j < count.Matrix[i].Count; j++)
- {
- Console.WriteLine(colorsList[count.Matrix[i][j] - 1]);
- Console.WriteLine(colorsList[i]);
- if (colorsList[count.Matrix[i][j] - 1] == colorsList[i])
- {
- color++;
- colorsList[i] = color;
- j = 1;
- }
- }
- }
- Individual ind = new Individual();
- ind.Colors = colorsList;
- Console.WriteLine("Konfliktów: " + count.GetConfolictQuantity(ind));
- Console.WriteLine("Kolorwów: " + ind.GetColorQunatity());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement