Beispiel #1
0
        public GPRunner(GPConfig config, string periodoAcao)
        {
            this.gpConfig = config;

            this.definitions = CreateSolutionDefinition();
            this.periodoAcao = periodoAcao;
            this.pool        = GPPool.LoadSaved(config, definitions, periodoAcao);
        }
Beispiel #2
0
 internal static GPPool LoadSaved(GPConfig config, GPSolutionDefinition definition, string periodoAcao)
 {
     try
     {
         var lista = new List <Type>();
         lista.Add(typeof(TradeSystem));
         var fileStream = File.Open("saved-pool-" + periodoAcao + ".js", FileMode.Open);
         DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(GPPool), lista);
         fileStream.Flush();
         fileStream.Position = 0;
         GPPool pool = (GPPool)ser.ReadObject(fileStream);
         pool.config = config;
         pool.FinishLoading(definition);
         fileStream.Close();
         return(pool);
     }
     catch (System.Exception e)
     {
     }
     return(new GPPool(config));
 }