Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/13/17 18:18:37 (7 years ago)
Author:
abeham
Message:

#2701:

  • Tagged unbiased models with property
  • Changed default configuration
  • Added solution distance to breeding, relinking and delinking performance models
  • Changed sampling model to base prediction on average distance in genotype space
  • Changed target for hillclimber and relinking to relative (quality improvement)
  • changed breeding to count cache hits per crossover
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRContext.cs

    r14552 r14563  
    197197    }
    198198    [Storable]
    199     private List<Tuple<double, double, double>> breedingStat;
    200     public List<Tuple<double, double, double>> BreedingStat {
     199    private List<Tuple<double, double, double, double>> breedingStat;
     200    public IEnumerable<Tuple<double, double, double, double>> BreedingStat {
    201201      get { return breedingStat; }
    202202    }
     
    207207    }
    208208    [Storable]
    209     private List<Tuple<double, double, double>> relinkingStat;
    210     public List<Tuple<double, double, double>> RelinkingStat {
     209    private List<Tuple<double, double, double, double>> relinkingStat;
     210    public IEnumerable<Tuple<double, double, double, double>> RelinkingStat {
    211211      get { return relinkingStat; }
    212212    }
     
    217217    }
    218218    [Storable]
    219     private List<Tuple<double, double, double>> delinkingStat;
    220     public List<Tuple<double, double, double>> DelinkingStat {
     219    private List<Tuple<double, double, double, double>> delinkingStat;
     220    public IEnumerable<Tuple<double, double, double, double>> DelinkingStat {
    221221      get { return delinkingStat; }
    222222    }
     
    228228    [Storable]
    229229    private List<Tuple<double, double>> samplingStat;
    230     public List<Tuple<double, double>> SamplingStat {
     230    public IEnumerable<Tuple<double, double>> SamplingStat {
    231231      get { return samplingStat; }
    232232    }
     
    238238    [Storable]
    239239    private List<Tuple<double, double>> hillclimbingStat;
    240     public List<Tuple<double, double>> HillclimbingStat {
     240    public IEnumerable<Tuple<double, double>> HillclimbingStat {
    241241      get { return hillclimbingStat; }
    242242    }
     
    248248    [Storable]
    249249    private List<Tuple<double, double>> adaptivewalkingStat;
    250     public List<Tuple<double, double>> AdaptivewalkingStat {
     250    public IEnumerable<Tuple<double, double>> AdaptivewalkingStat {
    251251      get { return adaptivewalkingStat; }
    252252    }
     
    276276      random = cloner.Clone(original.random);
    277277      breedingPerformanceModel = cloner.Clone(original.breedingPerformanceModel);
    278       breedingStat = original.breedingStat.Select(x => Tuple.Create(x.Item1, x.Item2, x.Item3)).ToList();
     278      breedingStat = original.breedingStat.Select(x => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4)).ToList();
    279279      relinkingPerformanceModel = cloner.Clone(original.relinkingPerformanceModel);
    280       relinkingStat = original.relinkingStat.Select(x => Tuple.Create(x.Item1, x.Item2, x.Item3)).ToList();
     280      relinkingStat = original.relinkingStat.Select(x => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4)).ToList();
    281281      delinkingPerformanceModel = cloner.Clone(original.delinkingPerformanceModel);
    282       delinkingStat = original.delinkingStat.Select(x => Tuple.Create(x.Item1, x.Item2, x.Item3)).ToList();
     282      delinkingStat = original.delinkingStat.Select(x => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4)).ToList();
    283283      samplingPerformanceModel = cloner.Clone(original.samplingPerformanceModel);
    284284      samplingStat = original.samplingStat.Select(x => Tuple.Create(x.Item1, x.Item2)).ToList();
     
    310310      Parameters.Add(random = new ValueParameter<IRandom>("Random", new MersenneTwister()));
    311311
    312       breedingStat = new List<Tuple<double, double, double>>();
    313       relinkingStat = new List<Tuple<double, double, double>>();
    314       delinkingStat = new List<Tuple<double, double, double>>();
     312      breedingStat = new List<Tuple<double, double, double, double>>();
     313      relinkingStat = new List<Tuple<double, double, double, double>>();
     314      delinkingStat = new List<Tuple<double, double, double, double>>();
    315315      samplingStat = new List<Tuple<double, double>>();
    316316      hillclimbingStat = new List<Tuple<double, double>>();
     
    344344
    345345    public void RelearnBreedingPerformanceModel() {
    346       breedingPerformanceModel = RunRegression(PrepareRegression(BreedingStat), breedingPerformanceModel).Model;
    347     }
    348     public bool BreedingSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2) {
     346      breedingPerformanceModel = RunRegression(PrepareRegression(ToListRow(breedingStat)), breedingPerformanceModel).Model;
     347    }
     348    public bool BreedingSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2, double dist) {
    349349      if (breedingPerformanceModel == null) return true;
    350350      double minI1 = double.MaxValue, minI2 = double.MaxValue, maxI1 = double.MinValue, maxI2 = double.MinValue;
     
    355355        if (d.Item2 > maxI2) maxI2 = d.Item2;
    356356      }
    357       if (IsBetter(p1, p2)) {
    358         if (p1.Fitness < minI1 || p1.Fitness > maxI1 || p2.Fitness < minI2 || p2.Fitness > maxI2)
    359           return true;
    360         return Random.NextDouble() < ProbabilityAccept3dModel(p1.Fitness, p2.Fitness, breedingPerformanceModel);
    361       }
    362       if (p1.Fitness < minI2 || p1.Fitness > maxI2 || p2.Fitness < minI1 || p2.Fitness > maxI1)
     357      if (p1.Fitness < minI1 || p1.Fitness > maxI1 || p2.Fitness < minI2 || p2.Fitness > maxI2)
    363358        return true;
    364       return Random.NextDouble() < ProbabilityAccept3dModel(p2.Fitness, p1.Fitness, breedingPerformanceModel);
     359     
     360      return Random.NextDouble() < ProbabilityAcceptAbsolutePerformanceModel(new List<double> { p1.Fitness, p2.Fitness, dist }, breedingPerformanceModel);
    365361    }
    366362
    367363    public void RelearnRelinkingPerformanceModel() {
    368       relinkingPerformanceModel = RunRegression(PrepareRegression(RelinkingStat), relinkingPerformanceModel).Model;
    369     }
    370     public bool RelinkSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2) {
     364      relinkingPerformanceModel = RunRegression(PrepareRegression(ToListRow(relinkingStat)), relinkingPerformanceModel).Model;
     365    }
     366    public bool RelinkSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2, double dist) {
    371367      if (relinkingPerformanceModel == null) return true;
    372368      double minI1 = double.MaxValue, minI2 = double.MaxValue, maxI1 = double.MinValue, maxI2 = double.MinValue;
     
    377373        if (d.Item2 > maxI2) maxI2 = d.Item2;
    378374      }
     375      if (p1.Fitness < minI1 || p1.Fitness > maxI1 || p2.Fitness < minI2 || p2.Fitness > maxI2)
     376        return true;
     377
    379378      if (IsBetter(p1, p2)) {
    380         if (p1.Fitness < minI1 || p1.Fitness > maxI1 || p2.Fitness < minI2 || p2.Fitness > maxI2)
    381           return true;
    382         return Random.NextDouble() < ProbabilityAccept3dModel(p1.Fitness, p2.Fitness, relinkingPerformanceModel);
    383       }
    384       if (p1.Fitness < minI2 || p1.Fitness > maxI2 || p2.Fitness < minI1 || p2.Fitness > maxI1)
    385         return true;
    386       return Random.NextDouble() < ProbabilityAccept3dModel(p2.Fitness, p1.Fitness, relinkingPerformanceModel);
     379        return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(p1.Fitness, new List<double> { p1.Fitness, p2.Fitness, dist }, relinkingPerformanceModel);
     380      }
     381      return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(p2.Fitness, new List<double> { p1.Fitness, p2.Fitness, dist }, relinkingPerformanceModel);
    387382    }
    388383
    389384    public void RelearnDelinkingPerformanceModel() {
    390       delinkingPerformanceModel = RunRegression(PrepareRegression(DelinkingStat), delinkingPerformanceModel).Model;
    391     }
    392     public bool DelinkSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2) {
     385      delinkingPerformanceModel = RunRegression(PrepareRegression(ToListRow(delinkingStat)), delinkingPerformanceModel).Model;
     386    }
     387    public bool DelinkSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2, double dist) {
    393388      if (delinkingPerformanceModel == null) return true;
    394389      double minI1 = double.MaxValue, minI2 = double.MaxValue, maxI1 = double.MinValue, maxI2 = double.MinValue;
     
    399394        if (d.Item2 > maxI2) maxI2 = d.Item2;
    400395      }
     396      if (p1.Fitness < minI1 || p1.Fitness > maxI1 || p2.Fitness < minI2 || p2.Fitness > maxI2)
     397        return true;
    401398      if (IsBetter(p1, p2)) {
    402         if (p1.Fitness < minI1 || p1.Fitness > maxI1 || p2.Fitness < minI2 || p2.Fitness > maxI2)
    403           return true;
    404         return Random.NextDouble() < ProbabilityAccept3dModel(p1.Fitness, p2.Fitness, delinkingPerformanceModel);
    405       }
    406       if (p1.Fitness < minI2 || p1.Fitness > maxI2 || p2.Fitness < minI1 || p2.Fitness > maxI1)
    407         return true;
    408       return Random.NextDouble() < ProbabilityAccept3dModel(p2.Fitness, p1.Fitness, delinkingPerformanceModel);
     399        return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(p1.Fitness, new List<double> { p1.Fitness, p2.Fitness, dist }, delinkingPerformanceModel);
     400      }
     401      return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(p2.Fitness, new List<double> { p1.Fitness, p2.Fitness, dist }, delinkingPerformanceModel);
    409402    }
    410403
    411404    public void RelearnSamplingPerformanceModel() {
    412       samplingPerformanceModel = RunRegression(PrepareRegression(SamplingStat), samplingPerformanceModel).Model;
    413     }
    414     public bool SamplingSuited() {
     405      samplingPerformanceModel = RunRegression(PrepareRegression(ToListRow(samplingStat)), samplingPerformanceModel).Model;
     406    }
     407    public bool SamplingSuited(double avgDist) {
    415408      if (samplingPerformanceModel == null) return true;
    416       return Random.NextDouble() < ProbabilityAccept2dModel(Population.Average(x => x.Fitness), samplingPerformanceModel);
     409      if (avgDist < samplingStat.Min(x => x.Item1) || avgDist > samplingStat.Max(x => x.Item1)) return true;
     410      return Random.NextDouble() < ProbabilityAcceptAbsolutePerformanceModel(new List<double> { avgDist }, samplingPerformanceModel);
    417411    }
    418412
    419413    public void RelearnHillclimbingPerformanceModel() {
    420       hillclimbingPerformanceModel = RunRegression(PrepareRegression(HillclimbingStat), hillclimbingPerformanceModel).Model;
     414      hillclimbingPerformanceModel = RunRegression(PrepareRegression(ToListRow(hillclimbingStat)), hillclimbingPerformanceModel).Model;
    421415    }
    422416    public bool HillclimbingSuited(ISingleObjectiveSolutionScope<TSolution> scope) {
    423       if (hillclimbingPerformanceModel == null) return true;
    424       if (scope.Fitness < HillclimbingStat.Min(x => x.Item1) || scope.Fitness > HillclimbingStat.Max(x => x.Item1))
    425         return true;
    426       return Random.NextDouble() < ProbabilityAccept2dModel(scope.Fitness, hillclimbingPerformanceModel);
     417      return HillclimbingSuited(scope.Fitness);
    427418    }
    428419    public bool HillclimbingSuited(double startingFitness) {
     
    430421      if (startingFitness < HillclimbingStat.Min(x => x.Item1) || startingFitness > HillclimbingStat.Max(x => x.Item1))
    431422        return true;
    432       return Random.NextDouble() < ProbabilityAccept2dModel(startingFitness, hillclimbingPerformanceModel);
     423      return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(startingFitness, new List<double> { startingFitness }, hillclimbingPerformanceModel);
    433424    }
    434425
    435426    public void RelearnAdaptiveWalkPerformanceModel() {
    436       adaptiveWalkPerformanceModel = RunRegression(PrepareRegression(AdaptivewalkingStat), adaptiveWalkPerformanceModel).Model;
     427      adaptiveWalkPerformanceModel = RunRegression(PrepareRegression(ToListRow(adaptivewalkingStat)), adaptiveWalkPerformanceModel).Model;
    437428    }
    438429    public bool AdaptivewalkingSuited(ISingleObjectiveSolutionScope<TSolution> scope) {
    439       if (adaptiveWalkPerformanceModel == null) return true;
    440       if (scope.Fitness < AdaptivewalkingStat.Min(x => x.Item1) || scope.Fitness > AdaptivewalkingStat.Max(x => x.Item1))
    441         return true;
    442       return Random.NextDouble() < ProbabilityAccept2dModel(scope.Fitness, adaptiveWalkPerformanceModel);
     430      return AdaptivewalkingSuited(scope.Fitness);
    443431    }
    444432    public bool AdaptivewalkingSuited(double startingFitness) {
     
    446434      if (startingFitness < AdaptivewalkingStat.Min(x => x.Item1) || startingFitness > AdaptivewalkingStat.Max(x => x.Item1))
    447435        return true;
    448       return Random.NextDouble() < ProbabilityAccept2dModel(startingFitness, adaptiveWalkPerformanceModel);
    449     }
    450 
    451     public IConfidenceRegressionSolution GetSolution(IConfidenceRegressionModel model, List<Tuple<double, double>> data) {
    452       return new ConfidenceRegressionSolution(model, PrepareRegression(data));
    453     }
    454     public IConfidenceRegressionSolution GetSolution(IConfidenceRegressionModel model, List<Tuple<double, double, double>> data) {
    455       return new ConfidenceRegressionSolution(model, PrepareRegression(data));
    456     }
    457 
    458     protected RegressionProblemData PrepareRegression(List<Tuple<double, double>> sample) {
    459       var inCol = new List<double>();
    460       var outCol = new List<double>();
     436      return Random.NextDouble() < ProbabilityAcceptAbsolutePerformanceModel(new List<double> { startingFitness }, adaptiveWalkPerformanceModel);
     437    }
     438
     439    public IConfidenceRegressionSolution GetSolution(IConfidenceRegressionModel model, IEnumerable<Tuple<double, double>> data) {
     440      return new ConfidenceRegressionSolution(model, PrepareRegression(ToListRow(data.ToList())));
     441    }
     442    public IConfidenceRegressionSolution GetSolution(IConfidenceRegressionModel model, IEnumerable<Tuple<double, double, double>> data) {
     443      return new ConfidenceRegressionSolution(model, PrepareRegression(ToListRow(data.ToList())));
     444    }
     445    public IConfidenceRegressionSolution GetSolution(IConfidenceRegressionModel model, IEnumerable<Tuple<double, double, double, double>> data) {
     446      return new ConfidenceRegressionSolution(model, PrepareRegression(ToListRow(data.ToList())));
     447    }
     448
     449    protected RegressionProblemData PrepareRegression(List<List<double>> sample) {
     450      var columns = sample.First().Select(y => new List<double>()).ToList();
    461451      foreach (var next in sample.Shuffle(Random)) {
    462         inCol.Add(next.Item1);
    463         outCol.Add(next.Item2);
    464       }
    465       var ds = new Dataset(new[] { "in", "out" }, new[] { inCol, outCol });
    466       var regPrb = new RegressionProblemData(ds, new[] { "in" }, "out") {
    467         TrainingPartition = { Start = 0, End = Math.Min(50, sample.Count) },
    468         TestPartition = { Start = Math.Min(50, sample.Count), End = sample.Count }
    469       };
    470       return regPrb;
    471     }
    472 
    473     protected RegressionProblemData PrepareRegression(List<Tuple<double, double, double>> sample) {
    474       var in1Col = new List<double>();
    475       var in2Col = new List<double>();
    476       var outCol = new List<double>();
    477       foreach (var next in sample.Shuffle(Random)) {
    478         in1Col.Add(next.Item1);
    479         in2Col.Add(next.Item2);
    480         outCol.Add(next.Item3);
    481       }
    482       var ds = new Dataset(new[] { "in1", "in2", "out" }, new[] { in1Col, in2Col, outCol });
    483       var regPrb = new RegressionProblemData(ds, new[] { "in1", "in2" }, "out") {
     452        for (var i = 0; i < next.Count; i++) {
     453          columns[i].Add(next[i]);
     454        }
     455      }
     456      var ds = new Dataset(columns.Select((v, i) => i < columns.Count - 1 ? "in" + i : "out").ToList(), columns);
     457      var regPrb = new RegressionProblemData(ds, Enumerable.Range(0, columns.Count - 1).Select(x => "in" + x), "out") {
    484458        TrainingPartition = { Start = 0, End = Math.Min(50, sample.Count) },
    485459        TestPartition = { Start = Math.Min(50, sample.Count), End = sample.Count }
     
    525499    }
    526500
    527     private double ProbabilityAccept2dModel(double a, IConfidenceRegressionModel model) {
    528       var ds = new Dataset(new[] { "in", "out" }, new[] { new List<double> { a }, new List<double> { double.NaN } });
     501    private double ProbabilityAcceptAbsolutePerformanceModel(List<double> inputs, IConfidenceRegressionModel model) {
     502      var inputVariables = inputs.Select((v, i) => "in" + i);
     503      var ds = new Dataset(inputVariables.Concat( new [] { "out" }), inputs.Select(x => new List<double> { x }).Concat(new [] { new List<double> { double.NaN } }));
    529504      var mean = model.GetEstimatedValues(ds, new[] { 0 }).Single();
    530505      var sdev = Math.Sqrt(model.GetEstimatedVariances(ds, new[] { 0 }).Single());
    531506
     507      // calculate the fitness goal
    532508      var goal = Maximization ? Population.Min(x => x.Fitness) : Population.Max(x => x.Fitness);
    533509      var z = (goal - mean) / sdev;
    534       return Maximization ? 1.0 - Phi(z) /* P(X >= z) */ : Phi(z); // P(X <= z)
    535     }
    536 
    537     private double ProbabilityAccept3dModel(double a, double b, IConfidenceRegressionModel model) {
    538       var ds = new Dataset(new[] { "in1", "in2", "out" }, new[] { new List<double> { a }, new List<double> { b }, new List<double> { double.NaN } });
     510      // return the probability of achieving or surpassing that goal
     511      var y = alglib.invnormaldistribution(z);
     512      return Maximization ? 1.0 - y /* P(X >= z) */ : y; // P(X <= z)
     513    }
     514
     515    private double ProbabilityAcceptRelativePerformanceModel(double basePerformance, List<double> inputs, IConfidenceRegressionModel model) {
     516      var inputVariables = inputs.Select((v, i) => "in" + i);
     517      var ds = new Dataset(inputVariables.Concat(new[] { "out" }), inputs.Select(x => new List<double> { x }).Concat(new[] { new List<double> { double.NaN } }));
    539518      var mean = model.GetEstimatedValues(ds, new[] { 0 }).Single();
    540519      var sdev = Math.Sqrt(model.GetEstimatedVariances(ds, new[] { 0 }).Single());
    541520
    542       var goal = Maximization ? Population.Min(x => x.Fitness) : Population.Max(x => x.Fitness);
     521      // calculate the improvement goal
     522      var goal = Maximization ? Population.Min(x => x.Fitness) - basePerformance : basePerformance - Population.Max(x => x.Fitness);
    543523      var z = (goal - mean) / sdev;
    544       return Maximization ? 1.0 - Phi(z) /* P(X >= z) */ : Phi(z); // P(X <= z)
     524      // return the probability of achieving or surpassing that goal
     525      return 1.0 - alglib.invnormaldistribution(z); /* P(X >= z) */
     526    }
     527
     528    private static List<List<double>> ToListRow(List<Tuple<double, double>> rows) {
     529      return rows.Select(x => new List<double> { x.Item1, x.Item2 }).ToList();
     530    }
     531    private static List<List<double>> ToListRow(List<Tuple<double, double, double>> rows) {
     532      return rows.Select(x => new List<double> { x.Item1, x.Item2, x.Item3 }).ToList();
     533    }
     534    private static List<List<double>> ToListRow(List<Tuple<double, double, double, double>> rows) {
     535      return rows.Select(x => new List<double> { x.Item1, x.Item2, x.Item3, x.Item4 }).ToList();
    545536    }
    546537
     
    556547    }
    557548
    558     public void AddBreedingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, ISingleObjectiveSolutionScope<TSolution> child) {
     549    public void AddBreedingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
    559550      if (IsBetter(a, b))
    560         BreedingStat.Add(Tuple.Create(a.Fitness, b.Fitness, child.Fitness));
    561       else BreedingStat.Add(Tuple.Create(b.Fitness, a.Fitness, child.Fitness));
    562     }
    563 
    564     public void AddRelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, ISingleObjectiveSolutionScope<TSolution> child) {
     551        breedingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, child.Fitness));
     552      else breedingStat.Add(Tuple.Create(b.Fitness, a.Fitness, parentDist, child.Fitness));
     553      if (breedingStat.Count % 10 == 0) RelearnBreedingPerformanceModel();
     554    }
     555
     556    public void AddRelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
    565557      if (IsBetter(a, b))
    566         RelinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, child.Fitness));
    567       else RelinkingStat.Add(Tuple.Create(b.Fitness, a.Fitness, child.Fitness));
    568     }
    569 
    570     public void AddDelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, ISingleObjectiveSolutionScope<TSolution> child) {
     558        relinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - a.Fitness : a.Fitness - child.Fitness));
     559      else relinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - b.Fitness : b.Fitness - child.Fitness));
     560      if (relinkingStat.Count % 10 == 0) RelearnRelinkingPerformanceModel();
     561    }
     562
     563    public void AddDelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
    571564      if (IsBetter(a, b))
    572         DelinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, child.Fitness));
    573       else DelinkingStat.Add(Tuple.Create(b.Fitness, a.Fitness, child.Fitness));
    574     }
    575 
    576     public void AddSamplingResult(ISingleObjectiveSolutionScope<TSolution> sample) {
    577       SamplingStat.Add(Tuple.Create(Population.Average(x => x.Fitness), sample.Fitness));
     565        delinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - a.Fitness : a.Fitness - child.Fitness));
     566      else delinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - b.Fitness : b.Fitness - child.Fitness));
     567      if (delinkingStat.Count % 10 == 0) RelearnDelinkingPerformanceModel();
     568    }
     569
     570    public void AddSamplingResult(ISingleObjectiveSolutionScope<TSolution> sample, double avgDist) {
     571      samplingStat.Add(Tuple.Create(avgDist, sample.Fitness));
     572      if (samplingStat.Count % 10 == 0) RelearnSamplingPerformanceModel();
    578573    }
    579574
    580575    public void AddHillclimbingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
    581       HillclimbingStat.Add(Tuple.Create(input.Fitness, outcome.Fitness));
    582     }
    583 
    584     public void AddTabuwalkingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
    585       AdaptivewalkingStat.Add(Tuple.Create(input.Fitness, outcome.Fitness));
     576      hillclimbingStat.Add(Tuple.Create(input.Fitness, Maximization ? outcome.Fitness - input.Fitness : input.Fitness - outcome.Fitness));
     577      if (hillclimbingStat.Count % 10 == 0) RelearnHillclimbingPerformanceModel();
     578    }
     579
     580    public void AddAdaptivewalkingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
     581      adaptivewalkingStat.Add(Tuple.Create(input.Fitness, outcome.Fitness));
     582      if (adaptivewalkingStat.Count % 10 == 0) RelearnAdaptiveWalkPerformanceModel();
    586583    }
    587584
     
    609606    // license: "This code is in the public domain. Do whatever you want with it, no strings attached."
    610607    // added: 2016-11-19 21:46 CET
    611     protected static double Phi(double x) {
     608    /*protected static double Phi(double x) {
    612609      // constants
    613610      double a1 = 0.254829592;
     
    629626
    630627      return 0.5 * (1.0 + sign * y);
    631     }
     628    }*/
    632629    #endregion
    633630
Note: See TracChangeset for help on using the changeset viewer.