Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:45:10+00:00 2026-05-24T07:45:10+00:00

I have done an optimization with Pyevolve and after a look at the results

  • 0

I have done an optimization with Pyevolve and after a look at the results I wanted to add a few generation to have a better convergence. As an evaluation is quite long, I was wondering if I can resume my optimization to the last generation and add like 20 more generations. Everything must be set in the DB I hope so he can be possible.

Here is my GA properties (similar to the first example but with a more complicated evaluation function):

    # Genome instance, 1D List of 6 elements
genome = G1DList.G1DList(6)

# Sets the range max and min of the 1D List
genome.setParams(rangemin=1, rangemax=15)

# The evaluator function (evaluation function)
genome.evaluator.set(eval_func)

# Genetic Algorithm Instance
ga=GSimpleGA.GSimpleGA(genome)

# Set the Roulette Wheel selector method, the number of generations and
# the termination criteria
ga.selector.set(Selectors.GRouletteWheel)
ga.setGenerations(50)
ga.setPopulationSize(10)
ga.terminationCriteria.set(GSimpleGA.ConvergenceCriteria)

# Sets the DB Adapter, the resetDB flag will make the Adapter recreate
# the database and erase all data every run, you should use this flag
# just in the first time, after the pyevolve.db was created, you can
# omit it.
sqlite_adapter = DBAdapters.DBSQLite(identify="F-Beam-Optimization", resetDB=True)
ga.setDBAdapter(sqlite_adapter)

# Do the evolution, with stats dump
# frequency of 5 generations
ga.evolve(freq_stats=2)

Anyone with the idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:45:11+00:00Added an answer on May 24, 2026 at 7:45 am

    Hi after reviewing the documentation of Pyevolve there doesn’t seem to be any way to resume an evolution base on what you stored in the database (strange behaviour).

    If you want to implement this type of mechanism, you could look at pickling your population once and a while and implementing the whole thing in Pyevolve.

    Or, you could try DEAP a very open framework that let you see and manipulate every aspect of an evolutionary algorithm, transparently. And there is already some checkpointing mechanism implemented.

    Here is what your code would look like in DEAP.

    import random    
    from deap import algorithms, base, creator, tools
    
    # Create the needed types
    creator.create("FitnessMax", base.Fitness, weights=(1.0,))
    creator.create("Individual", list, fitness=creator.FitnessMax)
    
    # Container for the evolutionary tools
    toolbox = base.Toolbox()
    toolbox.register("attr", random.random, 1, 15)
    toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attr, 6)
    toolbox.register("population", tools.initRepeat, list, toolbox.individual)
    
    # Operator registering
    toolbox.register("evaluate", eval_func)
    toolbox.register("mate", tools.cxTwoPoints)
    toolbox.register("mutate", tools.mutGaussian, mu=0, sigma=1, indpb=0.05)
    toolbox.register("select", tools.selTournament, tournsize=3)
    
    population = toolbox.population(n=10)
    stats = tools.Statistics(key=lambda ind: ind.fitness.values)
    stats.register("Max", max)
    checkpoint = tools.Checkpoint(population=population)
    
    GEN, CXPB, MUTPB = 0, 0.5, 0.1
    while stats.Max() < CONDITION:
        # Apply standard variation (crossover followed by mutation)
        offspring = algorithms.varSimple(toolbox, population, cxpb=CXPB, mutpb=MUTPB)
    
        # Evaluate the individuals
        fits = toolbox.map(toolbox.evaluate, offspring)
        for fit, ind in zip(fits, offspring):
            ind.fitness.values = fit
    
        # Select the fittest individuals
        offspring = [toolbox.clone(ind) for ind in toolbox.select(offspring, len(offspring)]
        # The "[:]" is important to not replace the label but what it contains
        population[:] = offspring
    
        stats.update(population)
        if GEN % 20 == 0:
            checkpoint.dump("my_checkpoint")
        GEN += 1
    

    Note that the above code has not been tested. But it does everything you request for. Now how to load a checkpoint and restart an evolution.

    checkpoint = tools.Checkpoint()
    checkpoint.load("my_checkpoint.ems")
    population = checkpoint["population"]
    
    # Continue the evolution has in before
    

    Moreover, DEAP is very well documented and has over 25 diversified examples that help new user to ramp up very quickly, I also heard that developers answer to question very quickly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have done database optimization for dbs upto 3GB size. Need a really large
EDIT: Optimization results at end of this question! hi, i have a following code
I have done Java and JSP programming in the past, but I am new
I have done a bit of testing on this myself (During the server side
I have done a bit of research into this and it seems that the
I have done some searches looking for information about how to do logging with
I have done a little Django development, but it has all been in a
I have done this: $ z() { echo 'hello world'; } How do I
I have done jQuery and Ajax, but I am not able to get the
I have done the following code in JavaScript to put focus on the particular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.