Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17662

Ignore:
Timestamp:
07/09/20 16:11:31 (4 years ago)
Message:

#2825 Correction: Use NumberOfObjectives instead of Problem.Encoding.Length where it is correct.

File:
1 edited

Unmodified
Removed
• branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/NSGA3.cs

 r17661 } public int NumberOfObjectives => Problem.Maximization.Length; #endregion ProblemProperties } private void InitReferencePoints() { // Generate reference points and add them to results ReferencePoints = ReferencePoint.GenerateReferencePoints(random, Problem.Maximization.Length); ResultsGeneratedReferencePoints = Utility.ConvertToDoubleMatrix(ReferencePoints); } private void InitResults() { Results.Add(new Result(GeneratedReferencePointsResultName, "The initially generated reference points", new DoubleMatrix())); Results.Add(new Result(CurrentFrontResultName, "The Pareto Front", new DoubleMatrix())); } private void InitReferencePoints() { // Generate reference points and add them to results ReferencePoints = ReferencePoint.GenerateReferencePoints(random, NumberOfObjectives); ResultsGeneratedReferencePoints = Utility.ConvertToDoubleMatrix(ReferencePoints); } { // Find the ideal point double[] idealPoint = new double[Problem.Encoding.Length]; for (int j = 0; j < Problem.Encoding.Length; j++) double[] idealPoint = new double[NumberOfObjectives]; for (int j = 0; j < NumberOfObjectives; j++) { // Compute ideal point // Find the extreme points Solution[] extremePoints = new Solution[Problem.Encoding.Length]; for (int j = 0; j < Problem.Encoding.Length; j++) Solution[] extremePoints = new Solution[NumberOfObjectives]; for (int j = 0; j < NumberOfObjectives; j++) { // Compute extreme points double[] weights = new double[Problem.Encoding.Length]; for (int i = 0; i < Problem.Encoding.Length; i++) weights[i] = EPSILON; double[] weights = new double[NumberOfObjectives]; for (int i = 0; i < NumberOfObjectives; i++) weights[i] = EPSILON; weights[j] = 1; double func(Solution s) => ASF(s.Fitness, weights); foreach (var solution in Fronts[f]) { for (int i = 0; i < Problem.Encoding.Length; i++) for (int i = 0; i < NumberOfObjectives; i++) { if (Math.Abs(intercepts[i] - idealPoint[i]) > EPSILON) { List dimensions = new List(); for (int i = 0; i < Problem.Encoding.Length; i++) dimensions.Add(i); for (int i = 0; i < NumberOfObjectives; i++) dimensions.Add(i); double f(int dim) => x[dim] / weight[dim]; return Utility.Max(f, dimensions); if (duplicate) { // cannot construct the unique hyperplane (this is a casual method to deal with the condition) for (int f = 0; f < Problem.Encoding.Length; f++) for (int f = 0; f < NumberOfObjectives; f++) { // extreme_points[f] stands for the individual with the largest value of // Find the equation of the hyperplane List b = new List(); //(pop[0].objs().size(), 1.0); for (int i = 0; i < Problem.Encoding.Length; i++) for (int i = 0; i < NumberOfObjectives; i++) { b.Add(1.0); { List aux = new List(); for (int i = 0; i < Problem.Encoding.Length; i++) for (int i = 0; i < NumberOfObjectives; i++) aux.Add(s.Fitness[i]); a.Add(aux); // Find intercepts for (int f = 0; f < Problem.Encoding.Length; f++) for (int f = 0; f < NumberOfObjectives; f++) { intercepts.Add(1.0 / x[f]);
Note: See TracChangeset for help on using the changeset viewer.