Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.search.algorithms.sa.SAParameters.java

Here you can find all the information about the file org.dgpf.search.algorithms.sa.SAParameters.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-06-05 13:27:42
 * Created by       : Stefan Niemczyk, Marc Kirchhoff
 * Original Filename: org.dgpf.search.algorithms.sa.SAParameters.java
 * Version          : 1.0.2
 * Last modification: 2006-07-21
 *                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.sa;

import java.io.Serializable;

import org.dgpf.search.algorithms.sa.ta.TemperatureAdaptionStrategy;
import org.dgpf.search.api.FitnessFunction;
import org.dgpf.search.api.SearchData;
import org.dgpf.search.api.SearchParameters;
import org.sfc.meta.MetaInformation;
import org.sfc.utils.Typesafe;


/**
 * The parameters of the simulated annealing engine.
 * @param <Genotype> The genotype of the elements to be evolved.
 *
 * @author Stefan Niemczyk, Marc Kirchhoff
 */

public class SAParameters<Genotype extends Serializable>
                                   extends SearchParameters<Genotype>
  {
/**
 * The serial version uid.
 */

  private static final long serialVersionUID = 1;
  

/**
 * The meta information of the simulated annealing parameter set.
 */

  public  static  final MetaInformation SA_PARAMETERS_METAINFO ;
  
  static
    {
    SAState.START_TEMPERATURE.add_port(SAParameters.class, true, true, null);
    SAState.TEMPERATURE.add_port(SAParameters.class, true, true, null); 
    SAState.TEMPERATURE_ADAPTION.add_port(SAParameters.class, true, true, null); 
    
    SA_PARAMETERS_METAINFO = new MetaInformation();
    }
  
/**
 * The parameter indicates the probability the worst individual will be 
 * used next. 
 */

  private double                        m_temperature;
  
/**
 * The temperature which was set at the beginning.
 */

  private double                        m_start_temperature;

  
/**
 * The parameter indicates the temperature adaption strategy.
 */

  private TemperatureAdaptionStrategy m_temperature_adaption_strategy;
  
  
/**
 * Create a new simulated annealing parameter set.
 * @param p_data  The search data to assign to.
 */

  public SAParameters (final SearchData p_data)
    {
    super(p_data);
    this.m_temperature        = SAUtils.DEFAULT_TEMPERATURE;
    this.m_start_temperature  = SAUtils.DEFAULT_TEMPERATURE;
    this.m_temperature_adaption_strategy =
      SAUtils.DEFAULT_TEMPERATURE_ADAPT_STRATEGY;
    }

/**
 * Create a new simulated annealing parameter set.
 * @param p_functions   The fitness functions to be applied in this
 *                      evolution.
 */

  public SAParameters(final FitnessFunction<Genotype,?>[]  p_functions)
    {
    this(p_functions.length);
    }

/**
 * Create a new simulated annealing parameter set.
 * @param p_ff_count  The count of fitness functions evaluated by this
 *                    search.
 */

  public SAParameters (final int p_ff_count)
    {
    super(p_ff_count);
    this.m_temperature        = SAUtils.DEFAULT_TEMPERATURE;
    this.m_start_temperature  = SAUtils.DEFAULT_TEMPERATURE;
    this.m_temperature_adaption_strategy =
      SAUtils.DEFAULT_TEMPERATURE_ADAPT_STRATEGY;
    }
  
/**
 * Get the m_temperature parameter.
 * @return The probability the worst individual will be used next.
 */

  public final double get_temperature()
    {
    return this.m_temperature;
    }
  
/**
 * Set the <code>m_temperature</code> parameter.
 * @param p_temperature  The new temperature value.
 */

  public final void set_temperature(final double p_temperature)
    {
    if(p_temperature >= 0.0d) this.m_temperature = p_temperature;
    }
  
/**
 * Get the m_start_temperature parameter.
 * @return The temperature which was set at the beginning.
 */

  public final double get_start_temperature()
    {
    return this.m_start_temperature;
    }
  
/**
 * Set the <code>m_start_temperature</code> parameter.
 * @param p_start_temperature  The start temperature value.
 */

  public final void set_start_temperature(final double p_start_temperature)
    {
    if(p_start_temperature >= 0)
      {
      this.m_start_temperature = p_start_temperature;
      }
    }
  
  
/**
 * Get the m_temperature_adaption_strategy parameter.
 * @return The current temperature adaption strategy.
 */

  public final TemperatureAdaptionStrategy get_temperature_adaption_strategy()
    {
    return this.m_temperature_adaption_strategy;
    }
  
/**
 * Set the <code>m_alpha</code> parameter.
 * @param p_temperature_adaption_strategy  The new 
 *        m_temperature_adaption_strategy value.
 */

  public final void set_temperature_adaption_strategy(
      final TemperatureAdaptionStrategy p_temperature_adaption_strategy)
    {
    if(p_temperature_adaption_strategy != null)
      {
      this.m_temperature_adaption_strategy = p_temperature_adaption_strategy;
      }
    }
  
/**
 * Assign the internal data of this search data to the data of
 * another one.
 * @param p_data  The simulation data  to assign to.
 */

  @Override
  public void  assign  (final Object p_data)
    { 
    SAState<Genotype> l_sas;
    SAParameters<Genotype> l_sap;
    
    super.assign(p_data);
    
    if(p_data instanceof SAState)
      {
      l_sas                    = Typesafe.cast(p_data);
      this.m_start_temperature = l_sas.get_start_temperature();
      this.m_temperature       = l_sas.get_temperature();
      }
    else
      {
      if(p_data instanceof SAParameters)
        {
        l_sap               = Typesafe.cast(p_data);
        
        this.m_temperature  = l_sap.get_temperature();
        this.m_temperature_adaption_strategy =
            l_sap.get_temperature_adaption_strategy();
        this.m_start_temperature =  l_sap.get_start_temperature();
        }
      }
    }
  }

File Information:

file name:SAParameters.java
package:org.dgpf.search.algorithms.sa
qualified name:org.dgpf.search.algorithms.sa.SAParameters.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/search/algorithms/sa/SAParameters.java
size:6.547 KB (6705 B)
uploaded: 2015-07-22 04:10:59 GMT+0000
last update: 2006-07-21 13:11:55 GMT+0000
last access: 2017-11-17 19:16:43 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-17 19:16:43 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo