/// <summary>
        /// Will renew "precentageToRenew" of the population when there isn't an improvement of at least "minImprovment" after "generationsToConsider" generations.
        /// </summary>
        public RenewIfNoImprovment(int generationsToConsider, double minImprvment, double precentageToRenew)
        {
            precentageToRenew.VerifyPrecentageToRenew();

            this.precentageToRenew = precentageToRenew;
            stopManager            = new StopIfNoImprovment(generationsToConsider, minImprvment);
        }
        /// <summary>
        /// Will renew "precentageToRenew" of the population when the difference between the min evaluation and max evaluation is equal to or less than "diff".
        /// </summary>
        public RenewAtConvergence(double diff, double precentageToRenew)
        {
            precentageToRenew.VerifyPrecentageToRenew();

            this.precentageToRenew = precentageToRenew;
            stopManager            = new StopManagers.StopAtConvergence(diff);
        }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime, IStartManager startManager, IStopManager stopManager, ILoggerManager logger, AppSetting appSetting)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.ConfigureExceptionHandler(logger);

            app.UseSwagger(x =>
            {
                x.SerializeAsV2 = true;
            });
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Xend CRM Api V1");
            });
            app.UseCors("AllowAllOrigins");
            app.UseMvc();
            lifetime.ApplicationStarted.Register(() => startManager.Start());
            lifetime.ApplicationStopping.Register(() => stopManager.Stop());
        }
Ejemplo n.º 4
0
 /// <summary>
 /// StopManagers let you configure when you want the search to stop.
 /// You can create your own managers by implementing the IStopManager class, or use one of the existing managers.
 /// Note that there is no limit to the number of StopManagers you can add to your search engine.
 /// </summary>
 public GeneticSearchEngineBuilder AddStopManager(IStopManager manager)
 {
     stopManagers.Add(manager);
     return(this);
 }