Differential Evolution

From jecoliwiki
Jump to: navigation, search


Contents


Example

DifferentialEvolutionConfiguration configuration = new DifferentialEvolutionConfiguration();
configuration.setEvaluationFunction( configureEvaluationFunction() );
		
ISolutionFactory<ILinearRepresentation<Double>> solutionFactory = configureSolutionFactory(); 
configuration.setSolutionFactory( solutionFactory );
		
configuration.setPopulationSize(populationSize);
configuration.setDoPopulationInitialization(true);
		
configuration.setRandomNumberGenerator(new DefaultRandomNumberGenerator());
configuration.setProblemBaseDirectory("nullDirectory");
configuration.setAlgorithmStateFile("nullFile");
configuration.setSaveAlgorithmStateDirectoryPath("nullDirectory");
configuration.setAlgorithmResultWriterList(new ArrayList<IAlgorithmResultWriter<ILinearRepresentation<Double>>>());
configuration.setStatisticsConfiguration(new StatisticsConfiguration());
		
ITerminationCriteria terminationCriteria = new IterationTerminationCriteria(numberGenerations);
configuration.setTerminationCriteria(terminationCriteria);
		
BaseVectorSelectionType baseVecSelType = BaseVectorSelectionType.RANDOM;
configuration.setBaseVectorSelectionType(baseVecSelType);
		
configuration.setScaleFactorF(0.6);
		
configuration.setCrossoverProbability(0.5);

Executing the Algorithm

The specific algorithm should be instantiated and the method run executed.

IAlgorithm<ILinearRepresentation<Double>> algorithm = 
      new SimulatedAnnealing<ILinearRepresentation<Double>,RealValueRepresentationFactory>(configuration);
IAlgorithmResult<ILinearRepresentation<Double>> result = algorithm.run();
Personal tools