All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ec.vector.breed.VectorMutationPipeline Maven / Gradle / Ivy

Go to download

ECJ, A Java-based Evolutionary Computation Research System. ECJ is a research EC system written in Java. It was designed to be highly flexible, with nearly all classes (and all of their settings) dynamically determined at runtime by a user-provided parameter file. All structures in the system are arranged to be easily modifiable. Even so, the system was designed with an eye toward efficiency. ECJ is developed at George Mason University's ECLab Evolutionary Computation Laboratory. The software has nothing to do with its initials' namesake, Evolutionary Computation Journal. ECJ's sister project is MASON, a multi-agent simulation system which dovetails with ECJ nicely.

The newest version!
/*
  Copyright 2006 by Sean Luke
  Licensed under the Academic Free License version 3.0
  See the file "LICENSE" for more information
*/


package ec.vector.breed;

import ec.vector.*;
import ec.*;
import ec.util.*;

/* 
 * VectorMutationPipeline.java
 * 
 * Created: Tue Mar 13 15:03:12 EST 2001
 * By: Sean Luke
 */


/**
 *
 VectorMutationPipeline is a BreedingPipeline which implements a simple default Mutation
 for VectorIndividuals.  Normally it takes an individual and returns a mutated 
 child individual. VectorMutationPipeline works by calling defaultMutate(...) on the 
 parent individual.
 
 

Typical Number of Individuals Produced Per produce(...) call
(however many its source produces)

Number of Sources
1

Default Base
vector.mutate (not that it matters) * @author Sean Luke * @version 1.0 */ public class VectorMutationPipeline extends BreedingPipeline { public static final String P_MUTATION = "mutate"; public static final int NUM_SOURCES = 1; public Parameter defaultBase() { return VectorDefaults.base().push(P_MUTATION); } /** Returns 1 */ public int numSources() { return NUM_SOURCES; } public int produce(final int min, final int max, final int start, final int subpopulation, final Individual[] inds, final EvolutionState state, final int thread) { // grab individuals from our source and stick 'em right into inds. // we'll modify them from there int n = sources[0].produce(min,max,start,subpopulation,inds,state,thread); // should we bother? if (!state.random[thread].nextBoolean(likelihood)) return reproduce(n, start, subpopulation, inds, state, thread, false); // DON'T produce children from source -- we already did // clone the individuals if necessary if (!(sources[0] instanceof BreedingPipeline)) for(int q=start;q





© 2015 - 2024 Weber Informatics LLC | Privacy Policy