private void TournamentSelection(ref List <Individual> afterSelection, int outSize)
 {
     CollectionActions.Shuffle(populationOfSolutions);                                              //zmniejszamy ryzyko wylosowania dwa razy tych samych
     for (int i = 0; i < populationOfSolutions.Count - 2 && afterSelection.Count < outSize; i += 2) //porównujemy pary
     {
         afterSelection.Add(GetSelectedIndividual(i, i + 1));
     }
 }
 private void PrepareBasicPopulation()
 {
     for (int i = 0; i < populationSize; i++)
     {
         List <int> clonedIndexes = CloneIndexesList(columnsIndexes);
         CollectionActions.Shuffle(clonedIndexes);
         populationOfSolutions.Add(new Individual(clonedIndexes, this));
     }
 }
        private string GetTransponedMatrix()
        {
            List <string> columns = new List <string>();
            string        outLine = "";

            for (int column = 0; column < dataGridView1.Columns.Count; column++)
            {
                string outColumn = "";
                for (int row = 0; row < dataGridView1.Rows.Count; row++)
                {
                    outColumn += ValueInCell(column, row) + " ";
                }
                columns.Add(outColumn);
            }

            CollectionActions.Shuffle(columns); //Losowe mieszanie kolumn
            foreach (string col in columns)
            {
                outLine += col + Environment.NewLine;
            }
            return(outLine);
        }