Changeset 5337 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators
- Timestamp:
- 01/20/11 01:30:44 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmExecutor.cs
r5281 r5337 11 11 /// </summary> 12 12 public class AlgorithmExecutor { 13 private EngineAlgorithm algorithm;13 private IAlgorithm algorithm; 14 14 private AutoResetEvent waitHandle = new AutoResetEvent(false); 15 15 16 public AlgorithmExecutor( EngineAlgorithm algorithm) {16 public AlgorithmExecutor(IAlgorithm algorithm) { 17 17 this.algorithm = algorithm; 18 18 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/ParameterConfigurationEvaluator.cs
r5313 r5337 30 30 get { return (ILookupParameter<TypeValue>)Parameters[MetaOptimizationProblem.AlgorithmTypeParameterName]; } 31 31 } 32 public ILookupParameter<IItemList<I SingleObjectiveProblem>> ProblemsParameter {33 get { return (ILookupParameter<IItemList<I SingleObjectiveProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }32 public ILookupParameter<IItemList<IProblem>> ProblemsParameter { 33 get { return (ILookupParameter<IItemList<IProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; } 34 34 } 35 35 public ILookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter { … … 58 58 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The evaluated quality of the ParameterVector.")); 59 59 Parameters.Add(new LookupParameter<TypeValue>(MetaOptimizationProblem.AlgorithmTypeParameterName, "Missing description.")); 60 Parameters.Add(new LookupParameter<IItemList<I SingleObjectiveProblem>>(MetaOptimizationProblem.ProblemsParameterName, "Missing description."));60 Parameters.Add(new LookupParameter<IItemList<IProblem>>(MetaOptimizationProblem.ProblemsParameterName, "Missing description.")); 61 61 Parameters.Add(new LookupParameter<ParameterConfigurationTree>("ParameterConfigurationTree", "Missing description.")); 62 62 Parameters.Add(new LookupParameter<IntValue>(MetaOptimizationProblem.RepetitionsParameterName, "Number of evaluations on one problem.")); … … 77 77 public override IOperation Apply() { 78 78 ParameterConfigurationTree parameterConfiguration = ParameterConfigurationParameter.ActualValue; 79 EngineAlgorithm algorithm = (EngineAlgorithm)Activator.CreateInstance(AlgorithmTypeParameter.ActualValue.Value);80 IItemList<I SingleObjectiveProblem> problems = ProblemsParameter.ActualValue;79 IAlgorithm algorithm = (IAlgorithm)Activator.CreateInstance(AlgorithmTypeParameter.ActualValue.Value); 80 IItemList<IProblem> problems = ProblemsParameter.ActualValue; 81 81 ItemDictionary<StringValue, RunCollection> runsCache = ResultsParameter.ActualValue.ContainsKey("Runs") ? (ItemDictionary<StringValue, RunCollection>)ResultsParameter.ActualValue["Runs"].Value : null; 82 82 double[] referenceQualities = GetReferenceQualities(problems); … … 113 113 } 114 114 115 private double[] GetReferenceQualities(IItemList<I SingleObjectiveProblem> problems) {115 private double[] GetReferenceQualities(IItemList<IProblem> problems) { 116 116 double[] referenceQualities; 117 117 if (ProblemQualityReferencesParameter.ActualValue == null) { … … 127 127 } 128 128 129 private RunCollection ExecuteAlgorithm(ParameterConfigurationTree parameterConfiguration, EngineAlgorithm algorithm, IItemList<ISingleObjectiveProblem> problems) {130 EngineAlgorithm algorithmClone = (EngineAlgorithm)algorithm.Clone();129 private RunCollection ExecuteAlgorithm(ParameterConfigurationTree parameterConfiguration, IAlgorithm algorithm, IItemList<IProblem> problems) { 130 IAlgorithm algorithmClone = (IAlgorithm)algorithm.Clone(); 131 131 132 132 // set parameters … … 134 134 algorithmClone.StoreAlgorithmInEachRun = false; 135 135 136 algorithmClone.Engine = new SequentialEngine.SequentialEngine(); 136 if (algorithmClone is EngineAlgorithm) { 137 ((EngineAlgorithm)algorithmClone).Engine = new SequentialEngine.SequentialEngine(); 138 } 137 139 algorithmClone.Prepare(true); 138 140 139 foreach (I SingleObjectiveProblem problem in problems) {141 foreach (IProblem problem in problems) { 140 142 algorithmClone.Problem = (IProblem)problem.Clone(); 141 143
Note: See TracChangeset
for help on using the changeset viewer.