Changeset 14087
- Timestamp:
- 07/15/16 14:25:02 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ichiriac/HeuristicLab.Algorithms.GDE3/GDE3.cs
r13852 r14087 5 5 * This file is part of HeuristicLab. 6 6 * 7 * Implementation based on the GDE3 implementation in jMetal Framework https://github.com/jMetal/jMetal 7 8 * 8 9 * HeuristicLab is free software: you can redistribute it and/or modify … … 71 72 #region ParameterNames 72 73 private const string MaximumGenerationsParameterName = "Maximum Generations"; 74 private const string MaximumEvaluationsParameterName = "Maximum Evaluations"; 73 75 private const string CrossoverProbabilityParameterName = "CrossoverProbability"; 74 76 private const string PopulationSizeParameterName = "PopulationSize"; … … 82 84 get { return (IFixedValueParameter<IntValue>)Parameters[MaximumGenerationsParameterName]; } 83 85 } 86 public IFixedValueParameter<IntValue> MaximumEvaluationsParameter 87 { 88 get { return (IFixedValueParameter<IntValue>)Parameters[MaximumEvaluationsParameterName]; } 89 } 84 90 private ValueParameter<IntValue> PopulationSizeParameter 85 91 { … … 97 103 98 104 #region Properties 99 public int Maximum Evaluations105 public int MaximumGenerations 100 106 { 101 107 get { return MaximumGenerationsParameter.Value.Value; } … … 103 109 } 104 110 111 public int MaximumEvaluations 112 { 113 get { return MaximumEvaluationsParameter.Value.Value; } 114 set { MaximumEvaluationsParameter.Value.Value = value; } 115 } 116 105 117 public Double CrossoverProbability 106 118 { … … 209 221 { 210 222 Parameters.Add(new FixedValueParameter<IntValue>(MaximumGenerationsParameterName, "", new IntValue(1000))); 223 Parameters.Add(new FixedValueParameter<IntValue>(MaximumEvaluationsParameterName, "", new IntValue(Int32.MaxValue))); 211 224 Parameters.Add(new ValueParameter<IntValue>(PopulationSizeParameterName, "The size of the population of solutions.", new IntValue(100))); 212 225 Parameters.Add(new ValueParameter<DoubleValue>(CrossoverProbabilityParameterName, "The value for crossover rate", new DoubleValue(0.5))); … … 261 274 int generations = 1; 262 275 263 while (Results Generations < MaximumGenerationsParameter.Value.Value276 while (ResultsEvaluations < MaximumEvaluationsParameter.Value.Value 264 277 && !cancellationToken.IsCancellationRequested) 265 278 { … … 353 366 ResultsBestFront = new DoubleMatrix(MultiObjectiveTestFunctionProblem.To2D(qualitiesFinal)); 354 367 ResultsCrowding = Crowding.Calculate(qualitiesFinal, Problem.TestFunction.Bounds(objectives)); 355 ResultsInvertedGenerationalDistance = InvertedGenerationalDistance.Calculate(en, optimalfront, 1); 368 GenerationalDistanceCalculator distance = new GenerationalDistanceCalculator(); 369 ResultsInvertedGenerationalDistance = distance.CalculateGenerationalDistance(qualitiesFinal, opf, Problem.Objectives); 356 370 ResultsHypervolume = Hypervolume.Calculate(frontVectors, Problem.TestFunction.ReferencePoint(objectives), Problem.TestFunction.Maximization(objectives)); 357 371 ResultsGenerationalDistance = GenerationalDistance.Calculate(qualitiesFinal, optimalfront, 1); … … 397 411 } 398 412 399 pr otectedSolutionSet createIndividual()413 private SolutionSet createIndividual() 400 414 { 401 415 var dim = Problem.ProblemSize; … … 423 437 } 424 438 425 pr otectedvoid initProgress()439 private void initProgress() 426 440 { 427 441 this.evals = PopulationSizeParameter.Value.Value; 428 442 } 429 443 430 pr otectedvoid updateProgres()444 private void updateProgres() 431 445 { 432 446 this.evals++; 433 447 } 434 448 435 pr otectedSolutionSet[] selection(List<SolutionSet> population, int i)449 private SolutionSet[] selection(List<SolutionSet> population, int i) 436 450 { 437 451 SolutionSet[] parents = new SolutionSet[3]; … … 458 472 } 459 473 460 pr otectedSolutionSet reproduction(SolutionSet parent, SolutionSet[] parentsSolutions)474 private SolutionSet reproduction(SolutionSet parent, SolutionSet[] parentsSolutions) 461 475 { 462 476 var individual = createEmptyIndividual(); … … 516 530 } 517 531 518 p ublicvoid crowdingDistanceAssignment(List<SolutionSet> rankingSubfront)532 private void crowdingDistanceAssignment(List<SolutionSet> rankingSubfront) 519 533 { 520 534 int size = rankingSubfront.Count;
Note: See TracChangeset
for help on using the changeset viewer.