}//Crossover2 Finish

        //Crossover3 Start

        public void Crossover3(ref List <Chromosome> parents, double probability)
        {
            List <Chromosome> offspring = new List <Chromosome>();

            for (int i = 0; i < parents.Count / 2; i++)
            {
                if (Assay(probability)) //if the chance is to crossover
                {
                    Chromosome parentX = AssayRuletteWheel(parents);
                    Chromosome parentY = AssayRuletteWheel(parents);

                    List <int> child1 = new List <int>();
                    List <int> child2 = new List <int>();
                    for (int c = 0; c < a; c++)
                    {
                        child1.Add(-1);
                        child2.Add(-1);
                    }
                    int intervalB = random.Next(0, a - 1);         //Index which starts of interval
                    int intervalF = random.Next(intervalB + 1, a); //Index which finish of interval
                    for (int j = intervalB; j < intervalF; j++)
                    {
                        child1[j] = parentX.genes[j];
                        child2[j] = parentY.genes[j];
                    }
                    for (int j = intervalB; j < intervalF; j++)
                    {
                        int index = j;
                        int cross;
                        if (child1.Contains(parentY.genes[index]))
                        {
                            continue;
                        }
                        for (int k = 0; k >= 0; k++)
                        {
                            cross = child1[index];
                            index = Array.IndexOf(parentY.genes, cross);
                            if (child1[index] != -1)
                            {
                                cross = child1[index];
                                index = Array.IndexOf(parentY.genes, cross);
                            }
                            if (child1[index] == -1)
                            {
                                child1[index] = parentY.genes[j];
                                break;
                            }
                        }
                        int index2 = j;
                        int cross2;
                        if (child2.Contains(parentX.genes[index2]))
                        {
                            continue;
                        }
                        for (int k = 0; k >= 0; k++)
                        {
                            cross2 = child2[index2];
                            index2 = Array.IndexOf(parentX.genes, cross2);
                            if (child2[index2] != -1)
                            {
                                cross2 = child2[index2];
                                index2 = Array.IndexOf(parentX.genes, cross2);
                            }
                            if (child2[index2] == -1)
                            {
                                child2[index2] = parentX.genes[j];
                                break;
                            }
                        }
                    }
                    for (int j = 0; j < a; j++)
                    {
                        if (child1[j] == -1)
                        {
                            for (int k = 0; k < parentY.genes.Length; k++)
                            {
                                if (!child1.Contains(parentY.genes[k]))//instead of deleting the similar genes from parents select the next non-contained number
                                {
                                    child1[j] = parentY.genes[k];
                                    break;
                                }
                            }
                        }
                        if (child2[j] == -1)
                        {
                            for (int k = 0; k < parentX.genes.Length; k++)
                            {
                                if (!child2.Contains(parentX.genes[k]))//instead of deleting the similar genes from parents select the next non-contained number
                                {
                                    child2[j] = parentX.genes[k];
                                    break;
                                }
                            }
                        }
                    }


                    Chromosome offSpr = new Chromosome();
                    offSpr.genes = child1.ToArray();
                    offspring.Add(offSpr);
                    offSpr.genes = child2.ToArray();
                    offspring.Add(offSpr);
                }
                else //else the chance is to clonning
                {
                    Chromosome parentX = AssayRuletteWheel(parents);
                    offspring.Add(parentX);
                    Chromosome parentY = AssayRuletteWheel(parents);
                    offspring.Add(parentY);
                }
            }

            while (offspring.Count > parents.Count)
            {
                offspring.RemoveAt((int)GetRandomVal(0, offspring.Count - 1));
            }

            parents = offspring;
        }//Crossover3 Finish
        }//Crossover3 Finish

        //Crossover4 Start

        public void Crossover4(ref List <Chromosome> parents, double probability)
        {
            List <Chromosome> offspring = new List <Chromosome>();

            for (int i = 0; i < parents.Count / 2; i++)
            {
                if (Assay(probability)) //if the chance is to crossover
                {
                    Chromosome parentX = AssayRuletteWheel(parents);
                    Chromosome parentY = AssayRuletteWheel(parents);

                    List <int> child1 = new List <int>();
                    List <int> child2 = new List <int>();
                    for (int c = 0; c < a; c++)
                    {
                        child1.Add(-1);
                        child2.Add(-1);
                    }
                    int        index = 0;
                    int        cross = parentX.genes[0];
                    int        cross2;
                    List <int> position = new List <int>();
                    for (int j = 0; j > 0; j++)
                    {
                        cross2 = parentY.genes[index];
                        index  = Array.IndexOf(parentX.genes, cross);
                        position.Add(index);
                        if (parentY.genes[index] == cross)
                        {
                            break;
                        }
                    }
                    for (int k = 0; k < a; k++)
                    {
                        if (!position.Contains(k))
                        {
                            child2[k] = parentX.genes[k];
                            child1[k] = parentY.genes[k];
                        }
                    }
                    Chromosome offSpr = new Chromosome();
                    offSpr.genes = child1.ToArray();
                    offspring.Add(offSpr);
                    offSpr.genes = child2.ToArray();
                    offspring.Add(offSpr);
                }
                else //else the chance is to clonning
                {
                    Chromosome parentX = AssayRuletteWheel(parents);
                    offspring.Add(parentX);
                    Chromosome parentY = AssayRuletteWheel(parents);
                    offspring.Add(parentY);
                }
            }

            while (offspring.Count > parents.Count)
            {
                offspring.RemoveAt((int)GetRandomVal(0, offspring.Count - 1));
            }

            parents = offspring;
        }//Crossover4 Finish
        }//Crossover1 Finish

        //Crossover2 Start

        public void Crossover2(ref List <Chromosome> parents, double probability)
        {
            List <Chromosome> offspring = new List <Chromosome>();

            for (int i = 0; i < parents.Count / 2; i++)
            {
                if (Assay(probability)) //if the chance is to crossover
                {
                    Chromosome parentX = AssayRuletteWheel(parents);
                    Chromosome parentY = AssayRuletteWheel(parents);

                    List <int> child1 = new List <int>();
                    List <int> child2 = new List <int>();
                    int        divide = random.Next(0, a);
                    for (int j = 0; j < a; j++)
                    {
                        if (j < divide)
                        {
                            child1.Add(parentX.genes[j]);
                        }
                        else
                        {
                            for (int k = 0; k < parentY.genes.Length; k++)
                            {
                                if (!child1.Contains(parentY.genes[k]))//instead of deleting the similar genes from parents select the next non-contained number
                                {
                                    child1.Add(parentY.genes[k]);
                                    break;
                                }
                            }
                        }
                        if (j < divide)
                        {
                            child2.Add(parentY.genes[j]);
                        }
                        else
                        {
                            for (int k = 0; k < parentX.genes.Length; k++)
                            {
                                if (!child2.Contains(parentX.genes[k]))//instead of deleting the similar genes from parents select the next non-contained number
                                {
                                    child2.Add(parentX.genes[k]);
                                    break;
                                }
                            }
                        }
                    }
                    Chromosome offSpr = new Chromosome();
                    offSpr.genes = child1.ToArray();
                    offspring.Add(offSpr);
                    offSpr.genes = child2.ToArray();
                    offspring.Add(offSpr);
                }
                else //else the chance is to clonning
                {
                    Chromosome parentX = AssayRuletteWheel(parents);
                    offspring.Add(parentX);
                    Chromosome parentY = AssayRuletteWheel(parents);
                    offspring.Add(parentY);
                }
            }

            while (offspring.Count > parents.Count)
            {
                offspring.RemoveAt((int)GetRandomVal(0, offspring.Count - 1));
            }

            parents = offspring;
        }//Crossover2 Finish