Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.search.algorithms.ga.GeneticStateBag.java

Here you can find all the information about the file org.dgpf.search.algorithms.ga.GeneticStateBag.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Thomas Weise
 *
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2006-04-10 09:57:24
 * Original Filename: org.dgpf.search.algorithms.ga.GeneticStateBag.java
 * Version          : 2.0.1
 * Last modification: 2006-05-28
 *                by: Thomas Weise
 *
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */


package org.dgpf.search.algorithms.ga;

import java.io.Serializable;

import org.dgpf.search.api.SearchState;
import org.dgpf.search.api.SearchStateBag;
import org.sfc.math.stochastic.statistics.StatisticInfoBag;

/**
 * The genetic state bag contains the state of the evolution. It is the
 * only instance able to access the data of the <code>GeneticState</code>.
 * You should place variables like the statistic bags into instances of
 * <code>GeneticStateBag</code> while putting the statistic info records
 * into <code>GeneticState</code>. This way you prevent them from being
 * serialized/cloned/copied/accessed whenever this is done to a genetic
 * state.
 *
 * @param <Genotype>    The sort of genotype used to represent individuals.
 *                      This must be a serializable type.
 *
 * @see GeneticState
 * @author Thomas Weise
 */

public class GeneticStateBag<Genotype extends Serializable>
                                      extends SearchStateBag<Genotype>
  {
/**
 * The serial version uid.
 */

  private static final long serialVersionUID = 2;


/**
 * The statistic info for the mutated elements.
 */

  StatisticInfoBag[]      m_mutation_stat    ;
/**
 * The statistic info for the elements derived using crossover.
 */

  StatisticInfoBag[]      m_crossover_stat  ;
/**
 * The statistic info for the elements randomly created.
 */

  StatisticInfoBag[]      m_new_stat         ;
/**
 * The statistic info for all the elements.
 */

  StatisticInfoBag[]      m_all_stat       ;

/**
 * Create a new genetic state bag.
 * @param p_ff_count  The count of fitness functions evaluated by this
 *                    search.
 */

  protected GeneticStateBag  (final int p_ff_count)
    {
    super(p_ff_count);
    }


/**
 * This method allows you to perform additional initialization before
 * the hosted search state will be created.
 * @param p_ff_count  The count of fitness functions evaluated by this
 *                    search.
 */

  @Override
  protected void  init  (int  p_ff_count)
    {
    StatisticInfoBag[]  l_m, l_c, l_n, l_a;

    this.m_mutation_stat   = l_m = new StatisticInfoBag[p_ff_count];
    this.m_crossover_stat  = l_c = new StatisticInfoBag[p_ff_count];
    this.m_new_stat        = l_n = new StatisticInfoBag[p_ff_count];
    this.m_all_stat        = l_a = new StatisticInfoBag[p_ff_count];


    for(--p_ff_count; p_ff_count >= 0; p_ff_count--)
      {
      l_m[p_ff_count] = new StatisticInfoBag();
      l_c[p_ff_count] = new StatisticInfoBag();
      l_n[p_ff_count] = new StatisticInfoBag();
      l_a[p_ff_count] = new StatisticInfoBag();
      }
    }

/**
 * This method is used internally to create a search state instance that
 * can be hosted by this bag.
 * @param p_ff_count  The count of fitness functions evaluated by this
 *                    search.
 * @return  The new search state.
 */

  @Override
  protected SearchState<Genotype> create_state (final int p_ff_count)
    {
    return new GeneticState<Genotype>(p_ff_count, this);
    }
  }

File Information:

file name:GeneticStateBag.java
package:org.dgpf.search.algorithms.ga
qualified name:org.dgpf.search.algorithms.ga.GeneticStateBag.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/search/algorithms/ga/GeneticStateBag.java
size:4.121 KB (4220 B)
uploaded: 2015-07-22 04:10:59 GMT+0000
last update: 2006-05-28 13:48:11 GMT+0000
last access: 2017-11-22 09:28:46 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2015-07-22 04:10:53 GMT+0000 served at 2017-11-22 09:28:46 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo