Changeset 14680


Ignore:
Timestamp:
02/17/17 13:01:00 (3 years ago)
Author:
abeham
Message:

#2701: disabled learning

  • updated HeuristicLab.Data to trunk
Location:
branches/MemPRAlgorithm
Files:
1 added
10 edited
1 moved

Legend:

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

    • Property svn:ignore
      •  

        old new  
        99GeneratedArtifacts
        1010_Pvt_Extensions
         11*.DotSettings
  • branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRAlgorithm.cs

    r14573 r14680  
    248248          Context.AddToPopulation(child);
    249249          Context.BestQuality = child.Fitness;
    250           Analyze(token);
     250          Analyze(CancellationToken.None);
    251251          token.ThrowIfCancellationRequested();
    252252          if (Terminate()) return;
  • branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRContext.cs

    r14573 r14680  
    346346    #region Breeding Performance
    347347    public void AddBreedingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
     348      return;
    348349      if (IsBetter(a, b))
    349350        breedingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, child.Fitness));
     
    352353    }
    353354    public void RelearnBreedingPerformanceModel() {
     355      return;
    354356      breedingPerformanceModel = RunRegression(PrepareRegression(ToListRow(breedingStat)), breedingPerformanceModel).Model;
    355357    }
    356358    public bool BreedingSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2, double dist) {
     359      return true;
    357360      if (breedingPerformanceModel == null) return true;
    358361      double minI1 = double.MaxValue, minI2 = double.MaxValue, maxI1 = double.MinValue, maxI2 = double.MinValue;
     
    372375    #region Relinking Performance
    373376    public void AddRelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
     377      return;
    374378      if (IsBetter(a, b))
    375379        relinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - a.Fitness : a.Fitness - child.Fitness));
     
    378382    }
    379383    public void RelearnRelinkingPerformanceModel() {
     384      return;
    380385      relinkingPerformanceModel = RunRegression(PrepareRegression(ToListRow(relinkingStat)), relinkingPerformanceModel).Model;
    381386    }
    382387    public bool RelinkSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2, double dist) {
     388      return true;
    383389      if (relinkingPerformanceModel == null) return true;
    384390      double minI1 = double.MaxValue, minI2 = double.MaxValue, maxI1 = double.MinValue, maxI2 = double.MinValue;
     
    401407    #region Delinking Performance
    402408    public void AddDelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
     409      return;
    403410      if (IsBetter(a, b))
    404411        delinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - a.Fitness : a.Fitness - child.Fitness));
     
    407414    }
    408415    public void RelearnDelinkingPerformanceModel() {
     416      return;
    409417      delinkingPerformanceModel = RunRegression(PrepareRegression(ToListRow(delinkingStat)), delinkingPerformanceModel).Model;
    410418    }
    411419    public bool DelinkSuited(ISingleObjectiveSolutionScope<TSolution> p1, ISingleObjectiveSolutionScope<TSolution> p2, double dist) {
     420      return true;
    412421      if (delinkingPerformanceModel == null) return true;
    413422      double minI1 = double.MaxValue, minI2 = double.MaxValue, maxI1 = double.MinValue, maxI2 = double.MinValue;
     
    429438    #region Sampling Performance
    430439    public void AddSamplingResult(ISingleObjectiveSolutionScope<TSolution> sample, double avgDist) {
     440      return;
    431441      samplingStat.Add(Tuple.Create(avgDist, sample.Fitness));
    432442      if (samplingStat.Count % 10 == 0) RelearnSamplingPerformanceModel();
    433443    }
    434444    public void RelearnSamplingPerformanceModel() {
     445      return;
    435446      samplingPerformanceModel = RunRegression(PrepareRegression(ToListRow(samplingStat)), samplingPerformanceModel).Model;
    436447    }
    437448    public bool SamplingSuited(double avgDist) {
     449      return true;
    438450      if (samplingPerformanceModel == null) return true;
    439451      if (avgDist < samplingStat.Min(x => x.Item1) || avgDist > samplingStat.Max(x => x.Item1)) return true;
     
    444456    #region Hillclimbing Performance
    445457    public void AddHillclimbingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
     458      return;
    446459      hillclimbingStat.Add(Tuple.Create(input.Fitness, Maximization ? outcome.Fitness - input.Fitness : input.Fitness - outcome.Fitness));
    447460      if (hillclimbingStat.Count % 10 == 0) RelearnHillclimbingPerformanceModel();
    448461    }
    449462    public void RelearnHillclimbingPerformanceModel() {
     463      return;
    450464      hillclimbingPerformanceModel = RunRegression(PrepareRegression(ToListRow(hillclimbingStat)), hillclimbingPerformanceModel).Model;
    451465    }
    452466    public bool HillclimbingSuited(double startingFitness) {
     467      return true;
    453468      if (hillclimbingPerformanceModel == null) return true;
    454469      if (startingFitness < HillclimbingStat.Min(x => x.Item1) || startingFitness > HillclimbingStat.Max(x => x.Item1))
     
    460475    #region Adaptivewalking Performance
    461476    public void AddAdaptivewalkingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
     477      return;
    462478      adaptivewalkingStat.Add(Tuple.Create(input.Fitness, Maximization ? outcome.Fitness - input.Fitness : input.Fitness - outcome.Fitness));
    463479      if (adaptivewalkingStat.Count % 10 == 0) RelearnAdaptiveWalkPerformanceModel();
    464480    }
    465481    public void RelearnAdaptiveWalkPerformanceModel() {
     482      return;
    466483      adaptiveWalkPerformanceModel = RunRegression(PrepareRegression(ToListRow(adaptivewalkingStat)), adaptiveWalkPerformanceModel).Model;
    467484    }
    468485    public bool AdaptivewalkingSuited(double startingFitness) {
     486      return true;
    469487      if (adaptiveWalkPerformanceModel == null) return true;
    470488      if (startingFitness < AdaptivewalkingStat.Min(x => x.Item1) || startingFitness > AdaptivewalkingStat.Max(x => x.Item1))
  • branches/MemPRAlgorithm/HeuristicLab.Data

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/crossvalidation-2434/HeuristicLab.Datamergedeligible
      /stable/HeuristicLab.Datamergedeligible
      /trunk/sources/HeuristicLab.Datamergedeligible
      /branches/1721-RandomForestPersistence/HeuristicLab.Data10321-10322
      /branches/Algorithms.GradientDescent/HeuristicLab.Data5516-5520
      /branches/Benchmarking/sources/HeuristicLab.Data6917-7005
      /branches/CloningRefactoring/HeuristicLab.Data4656-4721
      /branches/CodeEditor/HeuristicLab.Data11700-11806
      /branches/DataAnalysis Refactoring/HeuristicLab.Data5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Data5815-6180
      /branches/DataAnalysis/HeuristicLab.Data4458-4459,​4462,​4464
      /branches/DataPreprocessing/HeuristicLab.Data10085-11101
      /branches/GP.Grammar.Editor/HeuristicLab.Data6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Data5060
      /branches/HLScript/HeuristicLab.Data10331-10358
      /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Data11570-12508
      /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Data6123-9799
      /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Data11130-12721
      /branches/HiveStatistics/sources/HeuristicLab.Data12440-12877
      /branches/LogResidualEvaluator/HeuristicLab.Data10202-10483
      /branches/NET40/sources/HeuristicLab.Data5138-5162
      /branches/NSGA-II Changes/HeuristicLab.Data12033-12122
      /branches/ParallelEngine/HeuristicLab.Data5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Data7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Data6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Data6828
      /branches/RuntimeOptimizer/HeuristicLab.Data8943-9078
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Data7787-8333
      /branches/SlaveShutdown/HeuristicLab.Data8944-8956
      /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Data10204-10479
      /branches/SuccessProgressAnalysis/HeuristicLab.Data5370-5682
      /branches/Trunk/HeuristicLab.Data6829-6865
      /branches/UnloadJobs/HeuristicLab.Data9168-9215
      /branches/VNS/HeuristicLab.Data5594-5752
      /branches/histogram/HeuristicLab.Data5959-6341
  • branches/MemPRAlgorithm/HeuristicLab.Data/3.3

  • branches/MemPRAlgorithm/HeuristicLab.Data/3.3/EnumValue.cs

    r14185 r14680  
    5252    private EnumValue(EnumValue<T> original, Cloner cloner)
    5353      : base(original, cloner) {
    54       this.value = original.value;
    55       this.readOnly = original.readOnly;
    5654    }
    5755
     
    6462    }
    6563  }
     64
     65  public static class EnumHelper {
     66    public static T SetFlag<T>(this Enum value, T flag, bool set) {
     67      var baseType = Enum.GetUnderlyingType(value.GetType());
     68      dynamic valueAsBase = Convert.ChangeType(value, baseType);
     69      dynamic flagAsBase = Convert.ChangeType(flag, baseType);
     70      if (set)
     71        valueAsBase |= flagAsBase;
     72      else
     73        valueAsBase &= ~flagAsBase;
     74      return (T)valueAsBase;
     75    }
     76  }
    6677}
  • branches/MemPRAlgorithm/HeuristicLab.Data/3.3/HeuristicLab.Data-3.3.csproj

    r13695 r14680  
    108108  </PropertyGroup>
    109109  <ItemGroup>
     110    <Reference Include="Microsoft.CSharp" />
    110111    <Reference Include="System" />
    111112    <Reference Include="System.Core">
  • branches/MemPRAlgorithm/HeuristicLab.Data/3.3/ValueTypeMatrix.cs

    r14185 r14680  
    201201    }
    202202
     203    public virtual IEnumerable<T> GetRow(int row) {
     204      for (var col = 0; col < Columns; col++) {
     205        yield return matrix[row, col];
     206      }
     207    }
     208
     209    public virtual IEnumerable<T> GetColumn(int col) {
     210      for (var row = 0; row < Rows; row++) {
     211        yield return matrix[row, col];
     212      }
     213    }
     214
    203215    public override string ToString() {
    204216      if (matrix.Length == 0) return "[]";
  • branches/MemPRAlgorithm/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj

    r14550 r14680  
    127127    <Compile Include="Crossovers\NPointCrossover.cs" />
    128128    <Compile Include="BinaryVector.cs" />
    129     <Compile Include="HammingSimilarityCalculator.cs" />
     129    <Compile Include="SimilarityCalculators\HammingSimilarityCalculator.cs" />
    130130    <Compile Include="Interfaces\IBinaryVectorMultiNeighborhoodShakingOperator.cs" />
    131131    <Compile Include="Interfaces\IOneBitflipMoveOperator.cs" />
  • branches/MemPRAlgorithm/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.cs

    r14420 r14680  
    3030using HeuristicLab.Analysis;
    3131using HeuristicLab.Collections;
     32using HeuristicLab.Common;
    3233using HeuristicLab.Core.Views;
    3334using HeuristicLab.Data;
     
    334335      // aggregating over multiple problem instances     
    335336      var maxEfforts = new Dictionary<ProblemDescription, double>();
     337      var worstKnowns = new Dictionary<ProblemDescription, double>();
    336338      double minEff = double.MaxValue, maxEff = double.MinValue;
    337339      foreach (var group in groupedRuns) {
     
    343345          var bestKnownTarget = problem.Value.Item1;
    344346          var max = problem.Key.IsMaximization();
    345           var worstTarget = (max ? (1 - targets.Max()) : (1 + targets.Max())) * bestKnownTarget;
    346           var bestTarget = (max ? (1 - targets.Min()) : (1 + targets.Min())) * bestKnownTarget;
     347          double worstTarget = 0, bestTarget = 0;
     348          if (bestKnownTarget > 0) {
     349            worstTarget = (max ? (1 - targets.Max()) : (1 + targets.Max())) * bestKnownTarget;
     350            bestTarget = (max ? (1 - targets.Min()) : (1 + targets.Min())) * bestKnownTarget;
     351          } else if (bestKnownTarget < 0) {
     352            worstTarget = (max ? (1 + targets.Max()) : (1 - targets.Max())) * bestKnownTarget;
     353            bestTarget = (max ? (1 + targets.Min()) : (1 - targets.Min())) * bestKnownTarget;
     354          } else {
     355            var initials = problem.Value.Item2.Select(x => ((IndexedDataTable<double>)x.Results[table]).Rows.First().Values.First().Item2);
     356            var worstKnown = max ? initials.Min() : initials.Max();
     357            if (!worstKnown.IsAlmost(0)) {
     358              worstTarget = targets.Max() * worstKnown;
     359              bestTarget = targets.Min() * worstKnown;
     360              worstKnowns[problem.Key] = worstKnown;
     361            }
     362          }
    347363          foreach (var run in problem.Value.Item2) {
    348364            var row = ((IndexedDataTable<double>)run.Results[table]).Rows.First().Values;
     
    389405
    390406            if (aggregateTargetsCheckBox.Checked) {
    391               var length = CalculateHitsForAllTargets(hits, misses, resultsTable.Rows.First(), problem.Key, group.Key, problem.Value.Item1, maxEff);
     407              var length = CalculateHitsForAllTargets(hits, misses, resultsTable.Rows.First(), problem.Key, group.Key, problem.Value.Item1, worstKnowns.ContainsKey(problem.Key) ? worstKnowns[problem.Key] : 0, maxEff);
    392408              maxLength = Math.Max(length, maxLength);
    393409            } else {
    394               CalculateHitsForEachTarget(hits, misses, resultsTable.Rows.First(), problem.Key, group.Key, problem.Value.Item1, maxEff);
     410              CalculateHitsForEachTarget(hits, misses, resultsTable.Rows.First(), problem.Key, group.Key, problem.Value.Item1, worstKnowns.ContainsKey(problem.Key) ? worstKnowns[problem.Key] : 0, maxEff);
    395411            }
    396412            noRuns++;
     
    495511                                            Dictionary<string, SortedList<double, int>> misses,
    496512                                            IndexedDataRow<double> row, ProblemDescription problem,
    497                                             string group, double bestTarget, double maxEffort) {
    498       foreach (var t in targets.Select(x => Tuple.Create((problem.IsMaximization() ? (1 - x) : (1 + x)) * bestTarget, x))) {
     513                                            string group, double bestTarget, double worstKnown, double maxEffort) {
     514      var max = problem.IsMaximization();
     515      var targetValues = targets.Select(t => {
     516        double target = 0;
     517        if (bestTarget > 0) {
     518          target = (max ? (1 - t) : (1 + t)) * bestTarget;
     519        } else if (bestTarget < 0) {
     520          target = (max ? (1 + t) : (1 - t)) * bestTarget;
     521        } else {
     522          if (!worstKnown.IsAlmost(0))
     523            target = t * worstKnown;
     524        }
     525        return Tuple.Create(target, t);
     526      });
     527      foreach (var t in targetValues) {
    499528        var l = t.Item1;
    500529        var key = group + "_" + (t.Item2 * 100) + "%_" + l;
     
    515544        }
    516545        if (!hit) {
    517           var max = Math.Min(row.Values.Last().Item1, maxEffort);
    518           if (misses[key].ContainsKey(max))
    519             misses[key][max]++;
    520           else misses[key][max] = 1;
     546          var maxEff = Math.Min(row.Values.Last().Item1, maxEffort);
     547          if (misses[key].ContainsKey(maxEff))
     548            misses[key][maxEff]++;
     549          else misses[key][maxEff] = 1;
    521550        }
    522551      }
     
    526555                                              Dictionary<string, SortedList<double, int>> misses,
    527556                                              IndexedDataRow<double> row, ProblemDescription problem,
    528                                               string group, double bestTarget, double maxEffort) {
     557                                              string group, double bestTarget, double worstKnown, double maxEffort) {
    529558      var values = row.Values;
    530559      if (!hits.ContainsKey(group)) {
     
    536565      var j = 0;
    537566      while (i < targets.Length && j < values.Count) {
    538         var target = (problem.IsMaximization() ? (1 - targets[i]) : (1 + targets[i])) * bestTarget;
     567        var max = problem.IsMaximization();
     568        double target = 0;
     569        if (bestTarget > 0) {
     570          target = (max ? (1 - targets[i]) : (1 + targets[i])) * bestTarget;
     571        } else if (bestTarget < 0) {
     572          target = (max ? (1 + targets[i]) : (1 - targets[i])) * bestTarget;
     573        } else {
     574          if (!worstKnown.IsAlmost(0))
     575            target = targets[i] * worstKnown;
     576        }
    539577        var current = values[j];
    540578        if (current.Item1 > maxEffort) break;
Note: See TracChangeset for help on using the changeset viewer.