Beispiel #1
0
 public void Run()
 {
     if (Population == null || Population.Count <= 0)
     {
         throw new Exception("the initial population has not been defined");
     }
     if (NumberOfGenerations <= 0)
     {
         throw new Exception("the number of the generations must be greater than zero");
     }
     for (int i = 0; i < NumberOfGenerations; i++)
     {
         Population.Add(Population.Last().GenerateNextGeneration(Evaluation));
     }
 }
Beispiel #2
0
 public void Run(object param1 = null, object param2 = null, object param3 = null, object param4 = null, object param5 = null)
 {
     if (Population == null || Population.Count <= 0)
     {
         throw new Exception("the initial population has not been defined");
     }
     if (NumberOfGenerations <= 0)
     {
         throw new Exception("the number of the generations must be greater than zero");
     }
     Evaluation.Param1 = param1;
     Evaluation.Param2 = param2;
     Evaluation.Param3 = param3;
     Evaluation.Param4 = param4;
     Evaluation.Param5 = param5;
     for (int i = 0; i < NumberOfGenerations; i++)
     {
         Population.Add(Population.Last().GenerateNextGeneration(Evaluation));
     }
 }