Ejemplo n.º 1
0
        public GPRunner(GPConfig config, string periodoAcao)
        {
            this.gpConfig = config;

            this.definitions = CreateSolutionDefinition();
            this.periodoAcao = periodoAcao;
            this.pool        = GPPool.LoadSaved(config, definitions, periodoAcao);
        }
Ejemplo n.º 2
0
 public static GPConfig LoadSaved()
 {
     try
     {
         var fileStream = File.Open("GPConfig.js", FileMode.Open);
         DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(GPConfig));
         GPConfig config = (GPConfig)ser.ReadObject(fileStream);
         fileStream.Close();
         return(config);
     }
     catch (System.Exception e)
     {
     }
     return(new GPConfig());
 }
Ejemplo n.º 3
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));
 }
Ejemplo n.º 4
0
 public GPPool(GPConfig config)
 {
     this.config     = config;
     iterationNumber = 0;
     solutions       = new List <GPSolution>();
 }