- Timestamp:
- 06/20/20 12:33:24 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/NSGA3.cs
r17559 r17615 22 22 [Item("NSGA-III", "The Reference Point Based Non-dominated Sorting Genetic Algorithm III was introduced in Deb et al. 2013. An Evolutionary Many-Objective Optimization Algorithm Using Reference Point Based Non-dominated Sorting Approach. IEEE Transactions on Evolutionary Computation, 18(4), pp. 577-601.")] 23 23 [Creatable(Category = CreatableAttribute.Categories.PopulationBasedAlgorithms, Priority = 136)] 24 [StorableType(" 30DF878D-D655-4E76-B3AD-2292C9DD6C5F")]24 [StorableType("07C745F7-A8A3-4F99-8B2C-F97E639F9AC3")] 25 25 public class NSGA3 : BasicAlgorithm 26 26 { … … 49 49 [Storable] 50 50 private Solution[] solutions; 51 52 [Storable] 53 private List<ReferencePoint> referencePoints; 51 54 52 55 #endregion Storable fields … … 182 185 183 186 InitFields(); 187 InitReferencePoints(); 184 188 InitResults(); 185 InitReferencePoints();186 189 Analyze(); 187 190 } … … 200 203 random = new MersenneTwister(); 201 204 InitSolutions(); 202 }203 204 private void InitResults()205 {206 Results.Add(new Result(GeneratedReferencePointsResultName, "The initially generated reference points", new DoubleMatrix()));207 Results.Add(new Result(CurrentFrontResultName, "The Pareto Front", new DoubleMatrix()));208 }209 210 private void InitReferencePoints()211 {212 // Generate reference points and add them to results213 int nDiv = 5; // todo: figure out the correct number of divisions214 List<ReferencePoint> referencePoints = ReferencePoint.GenerateReferencePoints(Problem.Encoding.Length, nDiv);215 ResultsGeneratedReferencePoints = Utility.ConvertToDoubleMatrix(referencePoints);216 205 } 217 206 … … 233 222 solutions[i].Fitness = Evaluate(solutions[i].Chromosome); 234 223 } 224 } 225 226 private void InitReferencePoints() 227 { 228 // Generate reference points and add them to results 229 int nDiv = 5; // todo: figure out the correct number of divisions 230 referencePoints = ReferencePoint.GenerateReferencePoints(Problem.Encoding.Length, nDiv); 231 ResultsGeneratedReferencePoints = Utility.ConvertToDoubleMatrix(referencePoints); 232 } 233 234 private void InitResults() 235 { 236 Results.Add(new Result(GeneratedReferencePointsResultName, "The initially generated reference points", Utility.ConvertToDoubleMatrix(referencePoints))); 237 Results.Add(new Result(CurrentFrontResultName, "The Pareto Front", new DoubleMatrix())); 238 } 239 240 private void Analyze() 241 { 242 ResultsSolutions = solutions.Select(s => s.Chromosome.ToArray()).ToMatrix(); 243 Problem.Analyze( 244 solutions.Select(s => (Individual)new SingleEncodingIndividual(Problem.Encoding, new Scope { Variables = { new Variable(Problem.Encoding.Name, s.Chromosome) } })).ToArray(), 245 solutions.Select(s => s.Fitness).ToArray(), 246 Results, 247 random 248 ); 235 249 } 236 250 … … 246 260 } 247 261 248 private void Analyze()249 {250 ResultsSolutions = solutions.Select(s => s.Chromosome.ToArray()).ToMatrix();251 Problem.Analyze(252 solutions.Select(s => (Individual)new SingleEncodingIndividual(Problem.Encoding, new Scope { Variables = { new Variable(Problem.Encoding.Name, s.Chromosome) } })).ToArray(),253 solutions.Select(s => s.Fitness).ToArray(),254 Results,255 random256 );257 }258 259 262 #endregion Private Methods 260 263 }
Note: See TracChangeset
for help on using the changeset viewer.