Menu

Some questions about usage

shu57071
2016-04-15
2016-05-04
  • shu57071

    shu57071 - 2016-04-15

    Hi,Franz
    I appreciate such a friendly lib your shared with us.
    1.)
    Recently, I run some expriments using GA, so I try to use Jenetics. I need to record the total time of GA run as a serial progam and the total number of invidiuals generated in GA.
    But as I know, Jenetics run in multi threads. Is there any way to set it running in single threads or as a serial progam?
    2.)
    In some papers I read, there are terms "elite rate" and "cull rate".
    Is it correct that "elite rate" equals to 1.0-offspringFration?
    And does Jenetics have any method corresponding to "cull rate"?

     
  • Franz Wilhelmstötter

    ad 1) The EngineBuilder class allows you to set the Executor for parallel execution. So you simply create an Executor which executes the task in the main thread.

    final Engine<DoubleGene, Double> engine = Engine
        .builder(a -> a.getGene().getAllele(), DoubleChromosome.of(0, 1))
        // Do the execution in the main thread.
        .executor(Runnable::run)
        .populationSize(populationSize)
        .build();
    
    final AtomicLong created = new AtomicLong(0);
    final EvolutionResult<DoubleGene, Double> result = engine.stream()
        // Count the destroied (and re-created) individuals
        .peek(r -> {
            created.addAndGet(r.getInvalidCount());
            created.addAndGet(r.getKillCount());
        })
        .limit(10)
        .collect(EvolutionResult.toBestEvolutionResult());
    
    final long createdIndividualCount = 
        populationSize + created.get()
    

    You only can count the newly created individuals and not the altered one.

    ad 2) The elite rate selection can be defined by the survivor selector, but there is no EliteSelector available in the library. You have to implement it yourself. Have a look at https://sourceforge.net/p/jenetics/discussion/usage/thread/65268ef7/#37fa for implementing such Selector.
    The cull rate is new to me.

     

    Last edit: Franz Wilhelmstötter 2016-04-15
    • shu57071

      shu57071 - 2016-04-27

      Thanks for your reply!
      question 1 is solved.
      for cull rate, I've searched for some information these days and it is said that culling means "remove last (cull rate * poplation size) inviduals sorted by fitness from the popluation, and the rest of inviduals are used for reproduction".

      And another question: is there Uniform Crossover in Jenetics?

       
      • Franz Wilhelmstötter

        So you can use the TruncationSelector for the cull-rate.

        Jenetics currently doesn't have a UniformCrossover class.

         
  • shu57071

    shu57071 - 2016-05-04

    Thank you very much!

     
  • shiva

    shiva - 2017-01-30

    hello
    thanks for library.
    I have some difficulty with running .Is there any document or movie to help me ?

     

    Last edit: shiva 2017-01-30

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.