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

ec.eval.Job 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 and George Mason University
  Licensed under the Academic Free License version 3.0
  See the file "LICENSE" for more information
*/


package ec.eval;

import ec.*;
import java.io.*;
import ec.util.*;
import java.util.*;

/**
 * Job.java
 *

 This class stores information regarding a job submitted to a Slave: the individuals,
 the subpopulations in which they are stored, a scratch array for the individuals used
 internally, and various coevolutionary information (whether we should only count victories
 single-elimination-tournament style; which individuals should have their fitnesses updated).
 
 

Jobs are of two types: traditional evaluations (Slave.V_EVALUATESIMPLE), and coevolutionary evaluations (Slave.V_EVALUATEGROUPED). type indicates the type of job. For traditional evaluations, we may submit a group of individuals all at one time. Only the individuals and their subpopulation numbers are needed. Coevolutionary evaluations require the number of individuals, the subpopulations they come from, the pointers to the individuals, boolean flags indicating whether their fitness is to be updated or not, and another boolean flag indicating whether to count only victories in competitive tournament. * @author Liviu Panait * @version 1.0 */ public class Job { // either Slave.V_EVALUATESIMPLE or Slave.V_EVALUATEGROUPED int type; boolean sent = false; Individual[] inds; // original individuals Individual[] newinds; // individuals that were returned -- may be different individuals! int[] subPops; boolean countVictoriesOnly; boolean[] updateFitness; void copyIndividualsForward() { if (newinds == null || newinds.length != inds.length) newinds = new Individual[inds.length]; for(int i=0; i < inds.length; i++) { newinds[i] = (Individual)(inds[i].clone()); // delete the trials since they'll get remerged newinds[i].fitness.trials = null; // delete the context, since it'll get remerged newinds[i].fitness.setContext(null); } } void copyIndividualsBack(EvolutionState state) { for(int i = 0; i < inds.length; i++) inds[i].merge(state, newinds[i]); newinds = null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy