Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10794


Ignore:
Timestamp:
04/28/14 11:26:43 (11 years ago)
Author:
abeham
Message:

#2180: Fixed cloning of solutions in BestSingleObjectiveTestFunctionSolutionAnalyzer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Analyzers/BestSingleObjectiveTestFunctionSolutionAnalyzer.cs

    r9456 r10794  
    138138      if (solution == null) {
    139139        ResultCollection results = ResultsParameter.ActualValue;
    140         solution = new SingleObjectiveTestFunctionSolution(realVectors[i], qualities[i], EvaluatorParameter.ActualValue);
    141         solution.Population = realVectors[i].Length == 2 ? realVectors : null;
     140        solution = new SingleObjectiveTestFunctionSolution((RealVector)realVectors[i].Clone(),
     141                                                           (DoubleValue)qualities[i].Clone(),
     142                                                           EvaluatorParameter.ActualValue);
     143        solution.Population = realVectors[i].Length == 2
     144          ? new ItemArray<RealVector>(realVectors.Select(x => x.Clone()).Cast<RealVector>())
     145          : null;
    142146        solution.BestKnownRealVector = BestKnownSolutionParameter.ActualValue;
    143147        solution.Bounds = BoundsParameter.ActualValue;
     
    147151        if (max && qualities[i].Value > solution.BestQuality.Value
    148152          || !max && qualities[i].Value < solution.BestQuality.Value) {
    149           solution.BestRealVector = realVectors[i];
    150           solution.BestQuality = qualities[i];
     153          solution.BestRealVector = (RealVector)realVectors[i].Clone();
     154          solution.BestQuality = (DoubleValue)qualities[i].Clone();
    151155        }
    152         solution.Population = realVectors[i].Length == 2 ? realVectors : null;
     156        solution.Population = realVectors[i].Length == 2
     157          ? new ItemArray<RealVector>(realVectors.Select(x => x.Clone()).Cast<RealVector>())
     158          : null;
    153159      }
    154160
Note: See TracChangeset for help on using the changeset viewer.