Changeset 17664
- Timestamp:
- 07/12/20 15:35:34 (4 years ago)
- Location:
- branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/NSGA3.cs
r17663 r17664 53 53 54 54 [Storable] 55 private int generation;56 57 [Storable]58 55 private List<Solution> solutions; 59 56 … … 76 73 77 74 private const string GeneratedReferencePointsResultName = "Generated Reference Points"; 75 private const string CurrentGenerationResultName = "Generations"; 78 76 private const string CurrentFrontResultName = "Pareto Front"; // Do not touch this 79 77 … … 165 163 } 166 164 165 public IntValue ResultsCurrentGeneration 166 { 167 get { return (IntValue)Results[CurrentGenerationResultName].Value; } 168 set { Results[CurrentGenerationResultName].Value = value; } 169 } 170 167 171 #endregion ResultsProperties 168 172 … … 173 177 Parameters.Add(new FixedValueParameter<IntValue>(SeedName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); 174 178 Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); 175 Parameters.Add(new FixedValueParameter<IntValue>(PopulationSizeName, "The size of the population of Individuals.", new IntValue( ReferencePoint.GetNumberOfGeneratedReferencePoints(NumberOfObjectives))));179 Parameters.Add(new FixedValueParameter<IntValue>(PopulationSizeName, "The size of the population of Individuals.", new IntValue(200))); 176 180 Parameters.Add(new FixedValueParameter<PercentValue>(CrossoverProbabilityName, "The probability that the crossover operator is applied on two parents.", new PercentValue(0.9))); 177 181 Parameters.Add(new FixedValueParameter<DoubleValue>(CrossoverContiguityName, "The contiguity value for the Simulated Binary Crossover that specifies how close a child should be to its parents (larger value means closer). The value must be greater than or equal than 0. Typical values are in the range [2;5].")); … … 209 213 base.Initialize(cancellationToken); 210 214 215 PopulationSize.Value = ReferencePoint.GetNumberOfGeneratedReferencePoints(Problem.Maximization.Length); 211 216 InitResults(); 212 217 InitReferencePoints(); … … 225 230 { 226 231 random = new MersenneTwister(); 227 generation = 0;228 232 InitSolutions(); 229 233 } … … 249 253 Results.Add(new Result(GeneratedReferencePointsResultName, "The initially generated reference points", new DoubleMatrix())); 250 254 Results.Add(new Result(CurrentFrontResultName, "The Pareto Front", new DoubleMatrix())); 255 Results.Add(new Result(CurrentGenerationResultName, "The current generation", new IntValue(0))); 251 256 } 252 257 … … 257 262 protected override void Run(CancellationToken cancellationToken) 258 263 { 259 while ( generation !=MaximumGenerations.Value)264 while (ResultsCurrentGeneration.Value < MaximumGenerations.Value) 260 265 { 261 266 // create copies of generated reference points (to preserve the original ones for 262 267 // the next generation) maybe todo: use cloner? 263 268 ToNextGeneration(CreateCopyOfReferencePoints()); 264 generation++;269 ResultsCurrentGeneration.Value++; 265 270 } 266 271 } -
branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/Utility.cs
r17658 r17664 116 116 internal static Tuple<TIn, TOut> MinArgMin<TIn, TOut>(Func<TIn, TOut> func, IEnumerable<TIn> inputs) where TOut : IComparable 117 117 { 118 if (func == null) throw new ArgumentNullException(nameof(func)); 118 119 if (inputs == null) throw new ArgumentNullException(nameof(inputs)); 119 120 var it = inputs.GetEnumerator(); … … 162 163 internal static Tuple<TIn, TOut> MaxArgMax<TIn, TOut>(Func<TIn, TOut> func, IEnumerable<TIn> inputs) where TOut : IComparable 163 164 { 165 if (func == null) throw new ArgumentNullException(nameof(func)); 164 166 if (inputs == null) throw new ArgumentNullException(nameof(inputs)); 165 167 var it = inputs.GetEnumerator();
Note: See TracChangeset
for help on using the changeset viewer.