Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gp.automaton.search.Mutator.java

Here you can find all the information about the file org.dgpf.gp.automaton.search.Mutator.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2005 Thomas Weise
 * 
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2005-12-28 11:03:10
 * Original Filename: org.dgpf.automaton.genetics.Mutator.java
 * Version          : 2.2.1
 * Last modification: 2006-05-08
 *                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.gp.automaton.search;

import org.dgpf.gp.automaton.base.Instruction;
import org.dgpf.gp.automaton.base.Program;
import org.dgpf.gp.automaton.base.ProgramAccessor;


/**
 * This class is able to mutate something.
 * @param <Genotype>  The genotype of the objects to mutate.
 * @param <Return>    The return type of the mutation operation.
 * @author Thomas Weise
 */

public  abstract class Mutator<Return, Genotype extends Return>
                                                extends ProgramAccessor
  {  
/**
 * A default, non-modifying mutator.
 */

  public  static  final Mutator<Object, Object> DEFAULT_MUTATOR =
   new Mutator<Object, Object>()
   {
   @Override
   protected  final Object mutate(final  Object             p_source,
                                  final  ProgramContext     p_context,
                                  final  int                p_info,
                                  final  int                p_memory_size)
     {
     return p_source;
     }
   };
  
/**
 * Mutate an existing instance of the genotype.
 * @param p_source        The source instance.
 * @param p_context       The (calling) context to be used.
 * @param p_info          An additional information integer.
 * @param p_memory_size   The memory size currently available.
 * @return The randomly mutated copy of the source or <code>p_source</code>
 *         itself if it cannot be mutated in any way. 
 */

  protected abstract Return mutate(final  Genotype          p_source,
                                   final  ProgramContext    p_context,
                                   final  int               p_info,
                                   final  int               p_memory_size);
  
  
/**
 * A hack to allow the program context to access a program's code.
 * @param p_program The program to access.
 * @return  The source code of <code>p_program</code>. 
 */

  static  final Instruction[] do_get_code (final Program p_program)
    {
    return get_code(p_program);
    }
  }

File Information:

file name:Mutator.java
package:org.dgpf.gp.automaton.search
qualified name:org.dgpf.gp.automaton.search.Mutator.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gp/automaton/search/Mutator.java
size:3.117 KB (3192 B)
uploaded: 2015-07-22 04:10:55 GMT+0000
last update: 2006-05-08 13:38:47 GMT+0000
last access: 2017-11-22 07:34:58 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-23 07:34:28 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo