Esempio n. 1
0
        public double Evaluate(IChromosome chromosome)
        {
            var myC   = (MyProblemChromosome)chromosome;
            var genes = myC.GetGenes();

            OutputData = new OutputData(input.F);
            for (int i = 0; i < genes.Length; i++)
            {
                var car = Convert.ToInt32(genes[i].Value);
                OutputData.Rides[car].Add(i);
            }

            return(new Score(input, OutputData).Compute());
        }
Esempio n. 2
0
        public static void GenerateFile(OutputData outputData, string filePath)
        {
            var file = new System.IO.StreamWriter(filePath);

            file.NewLine = "\n";
            int ct = 0;

            foreach (var item in outputData.Rides)
            {
                StringBuilder s = new StringBuilder();
                s.Append(item.Count + " ");
                foreach (var i in item)
                {
                    s.Append(i + " ");
                }

                file.WriteLine(s.ToString());
            }
            file.Flush();
            file.Close();
        }
Esempio n. 3
0
 public Score(InputData input, OutputData output)
 {
     this.input  = input;
     this.output = output;
 }