Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/30/15 15:27:04 (9 years ago)
Author:
abeham
Message:

#2431:

  • Added calculation of RTs, RTus, FEs, FEus and prune runs in alg before every restart
  • merged changes from trunk
Location:
branches/PerformanceComparison/HeuristicLab.Analysis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Analysis

  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj

    r12804 r12813  
    105105  </PropertyGroup>
    106106  <ItemGroup>
    107     <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    108       <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
     107    <Reference Include="ALGLIB-3.9.0, Version=3.9.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     108      <HintPath>..\..\bin\ALGLIB-3.9.0.dll</HintPath>
    109109      <Private>False</Private>
    110110    </Reference>
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/Optimizers/IRRestarter.cs

    r12808 r12813  
    4444    private const string BestQualityResultName = "BestQuality";
    4545    private const string RandomRestartsResultName = "RandomRestarts";
     46    private const string RTsResultName = "RTs";
     47    private const string RTusResultName = "RTus";
     48    private const string FEsResultName = "FEs";
     49    private const string FEusResultName = "FEus";
    4650
    4751    public string Filename { get; set; }
     
    192196      get { return algorithm; }
    193197      set {
    194         if (value != null && !typeof(ISingleObjectiveHeuristicOptimizationProblem).IsAssignableFrom(value.ProblemType))
     198        if (value != null && !value.ProblemType.IsAssignableFrom(typeof(ISingleObjectiveHeuristicOptimizationProblem)))
    195199          throw new ArgumentException("Algorithm is not single-objective!");
    196200        if (algorithm == value) return;
     
    391395        CurrentRun.Results.Add(BestQualityResultName, new DoubleValue(Maximization ? double.MinValue : double.MaxValue));
    392396        CurrentRun.Results.Add(RandomRestartsResultName, new IntValue(0));
     397        CurrentRun.Results.Add(RTsResultName, new DoubleValue(0));
     398        CurrentRun.Results.Add(RTusResultName, new DoubleValue(0));
     399        CurrentRun.Results.Add(FEsResultName, new DoubleValue(0));
     400        CurrentRun.Results.Add(FEusResultName, new DoubleValue(0));
    393401      }
    394402      Algorithm.Start();
     
    517525
    518526      var execTime = ((TimeSpanValue)CurrentRun.Results[ExecutionTimeResultName]).Value;
     527      double evaluationsInThisRun = 0;
    519528      foreach (var result in Algorithm.Results) {
    520529        if (result.Name == perClockAnalyzer.QualityPerClockParameter.ResultName) {
     
    549558          }
    550559        } else if (result.Name == perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName) {
    551           var evalSols = ((IntValue)CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName]).Value;
    552           CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName] = new IntValue(evalSols + ((IntValue)result.Value).Value);
     560          var oldEvals = ((IntValue)CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName]).Value;
     561          var newEvals = ((IntValue)result.Value).Value;
     562          CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName] = new IntValue(oldEvals + newEvals);
     563          evaluationsInThisRun += newEvals;
    553564        } else if (result.Name == perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName) {
    554           var evalMoves = ((IntValue)CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName]).Value;
    555           CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName] = new IntValue(evalMoves + ((IntValue)result.Value).Value);
     565          var oldEvals = ((IntValue)CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName]).Value;
     566          var newEvals = ((IntValue)result.Value).Value;
     567          CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName] = new IntValue(oldEvals + newEvals);
     568          evaluationsInThisRun += newEvals * moveCostPerSolution;
    556569        } else if (result.Name == perEvaluationsAnalyzer.BestQualityParameter.ActualName) {
    557570          var best = ((DoubleValue)CurrentRun.Results[BestQualityResultName]).Value;
     
    566579      CurrentRun.Results[ExecutionTimeResultName] = new TimeSpanValue(execTime + Algorithm.ExecutionTime);
    567580
     581      // Algorithm sets ExecutionTime to zero before firing Prepared
     582      // We will thus see ExecutionTimeChanged before Prepared
     583      lastAlgorithmExecutionTime = TimeSpan.Zero;
     584
    568585      if (!forceStop && !IsFinished) {
    569         CurrentRun.Results[RandomRestartsResultName] = new IntValue(1 + ((IntValue)CurrentRun.Results[RandomRestartsResultName]).Value);
    570         Algorithm.Prepare();
     586        var restarts = ((IntValue)CurrentRun.Results[RandomRestartsResultName]).Value;
     587        if (restarts == 0) {
     588          CurrentRun.Results[RTusResultName] = new DoubleValue(Algorithm.ExecutionTime.TotalSeconds);
     589          CurrentRun.Results[FEusResultName] = new DoubleValue(evaluationsInThisRun);
     590        } else {
     591          var rtus = ((DoubleValue)CurrentRun.Results[RTusResultName]).Value;
     592          var feus = ((DoubleValue)CurrentRun.Results[FEusResultName]).Value;
     593          CurrentRun.Results[RTusResultName] = new DoubleValue(rtus * restarts / (restarts + 1.0) + Algorithm.ExecutionTime.TotalSeconds / (restarts + 1.0));
     594          CurrentRun.Results[FEusResultName] = new DoubleValue(feus * restarts / (restarts + 1.0) + evaluationsInThisRun / (restarts + 1.0));
     595        }
     596        CurrentRun.Results[RandomRestartsResultName] = new IntValue(restarts + 1);
     597        Algorithm.Prepare(true);
    571598        Algorithm.Start();
    572599      } else {
     600        if (Maximization && BestSoFar >= TargetValue || !Maximization && BestSoFar <= TargetValue) {
     601          CurrentRun.Results[RTsResultName] = (IItem)Algorithm.Results[perClockAnalyzer.QualityPerClockParameter.ResultName].Value.Clone();
     602          CurrentRun.Results[FEsResultName] = (IItem)Algorithm.Results[perEvaluationsAnalyzer.QualityPerEvaluationsParameter.ResultName].Value.Clone();
     603        }
    573604        forceStop = false;
    574605        Runs.Add(CurrentRun);
  • branches/PerformanceComparison/HeuristicLab.Analysis/3.3/Plugin.cs.frame

    r12753 r12813  
    2828  [Plugin("HeuristicLab.Analysis", "3.3.12.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Analysis-3.3.dll", PluginFileType.Assembly)]
    30   [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
     30  [PluginDependency("HeuristicLab.ALGLIB", "3.9")]
    3131  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3232  [PluginDependency("HeuristicLab.Common", "3.3")]
Note: See TracChangeset for help on using the changeset viewer.