Beispiel #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="t"></param>
        /// <param name="filename"></param>
        public void outputTiling(Coverage t, string filename)
        {
            StreamWriter stream = new StreamWriter(filename, false, Encoding.ASCII);
            stream.WriteLine("sep=,");
            string[] temp = new string[Program.col+Program.nTiles];
            for(int k=0; k<Program.nTiles;k++)
            {
                for (int k1 = 0; k1 < Program.nTiles; k1++)
                {
                    temp[k1] = ' '.ToString();
                }
                    for (int j = 0; j < Program.col; j++)
                {
                    temp[Program.nTiles+j] = t.getGene(k,j).ToString();
                }
                stream.WriteLine(String.Join(",", temp));
            }

            temp = new string[Program.nTiles];

            int i;
            for (int j = 0; j < Program.rows; j++)
            {
                i = 0;
                for (int k =0; k<Program.nTiles; k++)
                {
                    temp[i] = t.getPheno(k,j).ToString();
                    i++;
                }
                stream.WriteLine(String.Join(",", temp));
            }

            stream.Close();
        }
Beispiel #2
0
 public override bool beterthan(Coverage c)
 {
     if (this.getFit() > c.getFit())
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 private bool checkBestSol(int l)
 {
     if (individual[l].getFit() > bestSol)
     {
         bestSol = individual[l].getFit();
         bestIndividual = individual[l];
         return true;
     }
     else
     {
         return false;
     }
 }
 /// <summary>
 /// Set a random individual to c
 /// </summary>
 /// <param name="c">Individual to integrate randomly in the population</param>
 public void setRandom(Coverage c)
 {
     individual[Program.rnd.Next(popsize)] = c;
 }
 public virtual bool beterthan(Coverage c)
 {
     return false;
 }