Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/08/11 13:18:49 (13 years ago)
Author:
sforsten
Message:

#1669: First version which can automatically generate data for some problems from http://www.vanillamodeling.com/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblem.cs

    r5809 r6968  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
    2224using HeuristicLab.Common;
    2325using HeuristicLab.Core;
    2426using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.PluginInfrastructure;
    2528
    2629namespace HeuristicLab.Problems.DataAnalysis {
     
    4346      ProblemData = problemData;
    4447    }
     48
     49    public override IEnumerable<IDataAnalysisBenchmarkProblemDataGenerator> GetBenchmarkProblemDataGenerators() {
     50      return ApplicationManager.Manager.GetInstances<IRegressionBenchmarkProblemDataGenerator>();
     51    }
     52
     53    public override void CreateProblemDataFromBenchmark(IDataAnalysisBenchmarkProblemDataGenerator benchmarkGenerator) {
     54      if (!(benchmarkGenerator is IRegressionBenchmarkProblemDataGenerator)) {
     55        throw new ArgumentException("BenchmarkGenerator is not an IRegressionBenchmarkProblemDataGenerator.");
     56      }
     57
     58      IDataAnalysisProblemData problemData = benchmarkGenerator.GenerateProblemData();
     59
     60      if (problemData is IRegressionProblemData)
     61        ProblemData = (IRegressionProblemData)problemData;
     62      else
     63        throw new InvalidCastException("ProblemDataGenerator didn't return an IRegressionProblemData.");
     64    }
    4565  }
    4666}
Note: See TracChangeset for help on using the changeset viewer.