Difference between revisions of "Differential Evolution"

From jecoliwiki
Jump to: navigation, search
(Created page with "Category:Howtos __TOC__ ==== Example ==== DifferentialEvolutionConfiguration configuration = new DifferentialEvolutionConfiguration(); configuration.setEvaluationFunc...")
 

Latest revision as of 16:24, 5 March 2013


Contents


[edit] 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);

[edit] 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