Exemplo n.º 1
0
 public void Save(string fileName)
 {
     ThreadPool.QueueUserWorkItem(new WaitCallback((p) =>
     {
         try
         {
             IRepository<GAParams> repository = new GARepository((string)p);
             repository.Add(GAParams);
             repository.SaveChanges();
         }
         catch
         {
         }
     }), fileName);
 }
Exemplo n.º 2
0
 public void Load(string fileName)
 {
     IRepository<GAParams> repository = new GARepository(fileName);
     var value = repository.GetAll();
     if (value.Count() > 0)
     {
         GAParams = value.ToList()[0];
         Console.WriteLine("Loaded Genetic Algorithm: Crossover " + GAParams.CrossoverRate + ", Mutation Rate " + GAParams.MutationRate + ", Pop Size " + GAParams.PopulationSize + ", Gen Size " + GAParams.Generations + ", Current Gen " + GAParams.CurrentGeneration);
     }
 }