Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5337


Ignore:
Timestamp:
01/20/11 01:30:44 (13 years ago)
Author:
cneumuel
Message:

#1215

  • made all IAlgorithm types compatible to be loaded into MetaOptimization.
  • valid problem types are now automatically set
Location:
branches/HeuristicLab.MetaOptimization
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/MetaOptimizationProblemView.cs

    r5328 r5337  
    7272
    7373          if (dlgResult == DialogResult.OK) {
    74             EngineAlgorithm algorithm = Content.Algorithm;
     74            IAlgorithm algorithm = Content.Algorithm;
    7575            if(Content.Problems.Count > 0) algorithm.Problem = Content.Problems.First();
    7676            Experiment experiment;
     
    9393      Type type = e.Data.GetData("Type") as Type;
    9494      if ((type != null) && (Content.AlgorithmType.ValidTypes.Contains(type))) {
    95         EngineAlgorithm algorithm = e.Data.GetData("Value") as EngineAlgorithm;
    96         if (algorithm.Problem == null || Content.ProblemType.ValidTypes.Contains(algorithm.Problem.GetType())) {
     95        IAlgorithm algorithm = e.Data.GetData("Value") as IAlgorithm;
     96        if (algorithm != null && algorithm.Problem == null || Content.ProblemType.ValidTypes.Contains(algorithm.Problem.GetType())) {
    9797          e.Effect = DragDropEffects.Copy;
    9898        }
     
    101101    protected void parameterCollectionView_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) {
    102102      if (e.Effect != DragDropEffects.None) {
    103         EngineAlgorithm algorithm = e.Data.GetData("Value") as EngineAlgorithm;
     103        IAlgorithm algorithm = e.Data.GetData("Value") as IAlgorithm;
    104104        Content.ImportAlgorithm(algorithm);
    105105      }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ObjectSelectorDialog.Designer.cs

    r5110 r5337  
    4646      this.itemsListView.MultiSelect = false;
    4747      this.itemsListView.Name = "itemsListView";
    48       this.itemsListView.Size = new System.Drawing.Size(387, 501);
     48      this.itemsListView.Size = new System.Drawing.Size(653, 360);
    4949      this.itemsListView.TabIndex = 2;
    5050      this.itemsListView.UseCompatibleStateImageBehavior = false;
     
    7272      this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    7373      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    74       this.cancelButton.Location = new System.Drawing.Point(324, 519);
     74      this.cancelButton.Location = new System.Drawing.Point(590, 378);
    7575      this.cancelButton.Name = "cancelButton";
    7676      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    8484      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    8585      this.okButton.Enabled = false;
    86       this.okButton.Location = new System.Drawing.Point(243, 519);
     86      this.okButton.Location = new System.Drawing.Point(509, 378);
    8787      this.okButton.Name = "okButton";
    8888      this.okButton.Size = new System.Drawing.Size(75, 23);
     
    9898      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    9999      this.CancelButton = this.cancelButton;
    100       this.ClientSize = new System.Drawing.Size(411, 554);
     100      this.ClientSize = new System.Drawing.Size(677, 413);
    101101      this.Controls.Add(this.cancelButton);
    102102      this.Controls.Add(this.okButton);
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ObjectSelectorDialog.resx

    r4516 r5337  
    113113  </resheader>
    114114  <resheader name="reader">
    115     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     115    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    116116  </resheader>
    117117  <resheader name="writer">
    118     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120120</root>
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/BestParameterConfigurationAnalyzer.cs

    r5293 r5337  
    4242      get { return (LookupParameter<DoubleArray>)Parameters["ProblemQualityReferences"]; }
    4343    }
    44     public LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>> ProblemsParameter {
    45       get { return (LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
     44    public LookupParameter<ConstrainedItemList<IProblem>> ProblemsParameter {
     45      get { return (LookupParameter<ConstrainedItemList<IProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
    4646    }
    4747
     
    5656      Parameters.Add(new LookupParameter<RunCollection>("Population", ""));
    5757      Parameters.Add(new LookupParameter<DoubleArray>("ProblemQualityReferences", ""));
    58       Parameters.Add(new LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>>(MetaOptimizationProblem.ProblemsParameterName));
     58      Parameters.Add(new LookupParameter<ConstrainedItemList<IProblem>>(MetaOptimizationProblem.ProblemsParameterName));
    5959    }
    6060
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/ReferenceQualityAnalyzer.cs

    r5293 r5337  
    3030      get { return (LookupParameter<DoubleArray>)Parameters["ProblemQualityReferences"]; }
    3131    }
    32     public LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>> ProblemsParameter {
    33       get { return (LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
     32    public LookupParameter<ConstrainedItemList<IProblem>> ProblemsParameter {
     33      get { return (LookupParameter<ConstrainedItemList<IProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
    3434    }
    3535
     
    4040      Parameters.Add(new ScopeTreeLookupParameter<ParameterConfigurationTree>("ParameterConfigurationTree", ""));
    4141      Parameters.Add(new LookupParameter<DoubleArray>("ProblemQualityReferences", ""));
    42       Parameters.Add(new LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>>(MetaOptimizationProblem.ProblemsParameterName, ""));
     42      Parameters.Add(new LookupParameter<ConstrainedItemList<IProblem>>(MetaOptimizationProblem.ProblemsParameterName, ""));
    4343    }
    4444
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/RunsAnalyzer.cs

    r5303 r5337  
    3030      get { return (LookupParameter<DoubleArray>)Parameters["ProblemQualityReferences"]; }
    3131    }
    32     public LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>> ProblemsParameter {
    33       get { return (LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
     32    public LookupParameter<ConstrainedItemList<IProblem>> ProblemsParameter {
     33      get { return (LookupParameter<ConstrainedItemList<IProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
    3434    }
    3535    public ValueLookupParameter<ItemDictionary<StringValue, RunCollection>> RunsParameter {
     
    4343      Parameters.Add(new ScopeTreeLookupParameter<ParameterConfigurationTree>("ParameterConfigurationTree", ""));
    4444      Parameters.Add(new LookupParameter<DoubleArray>("ProblemQualityReferences", ""));
    45       Parameters.Add(new LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>>(MetaOptimizationProblem.ProblemsParameterName, ""));
     45      Parameters.Add(new LookupParameter<ConstrainedItemList<IProblem>>(MetaOptimizationProblem.ProblemsParameterName, ""));
    4646      Parameters.Add(new ValueLookupParameter<ItemDictionary<StringValue, RunCollection>>("Runs", "", new ItemDictionary<StringValue, RunCollection>()));
    4747    }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/ConstrainedTypeValue.cs

    r5328 r5337  
    1313  [Item("ConstrainedTypeValue", "Represents a type with constraints.")]
    1414  [StorableClass]
    15   public abstract class ConstrainedTypeValue : TypeValue {
     15  public class ConstrainedTypeValue : TypeValue {
    1616
    1717    [Storable]
     
    4242      this.validTypes = new List<Type>(original.validTypes);
    4343    }
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new ConstrainedTypeValue(this, cloner);
     46    }
    4447  }
    4548
     
    5659      this.Value = value;
    5760    }
     61    [StorableConstructor]
     62    protected ConstrainedTypeValue(bool deserializing) : base(deserializing) { }
    5863    protected ConstrainedTypeValue(ConstrainedTypeValue original, Cloner cloner) : base(original, cloner) { }
    5964    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs

    r5328 r5337  
    113113
    114114    #region constructors and cloning
    115     public ParameterConfigurationTree(EngineAlgorithm algorithm)
     115    public ParameterConfigurationTree(IAlgorithm algorithm)
    116116      : base(null, algorithm.GetType()) {
    117117      this.Optimize = true; // root must always be optimized
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs

    r5313 r5337  
    217217    }
    218218
    219     private IEnumerable<Type> GetValidTypes(IValueParameter parameter) {
     219    private static IEnumerable<Type> GetValidTypes(IValueParameter parameter) {
    220220      // in case of IOperator return empty list, otherwise hundreds of types would be returned. this mostly occurs for Successor which will never be optimized
    221221      if (parameter.DataType == typeof(IOperator))
    222222        return new List<Type>();
    223223
     224      // return only one type for ValueTypeValues<> (Int, Double, Percent, Bool). Otherwise 2 types would be returned for DoubleValue (PercentValue which is derived)
     225      if (IsSubclassOfRawGeneric(typeof(ValueTypeValue<>), parameter.DataType))
     226        return new List<Type> { parameter.DataType };
     227     
    224228      if (IsSubclassOfRawGeneric(typeof(OptionalConstrainedValueParameter<>), parameter.GetType())) {
     229        // use existing validvalues if known
    225230        var parameterValidValues = (IEnumerable)parameter.GetType().GetProperty("ValidValues").GetValue(parameter, new object[] { });
    226231        return parameterValidValues.Cast<object>().Select(x => x.GetType());
    227232      } else {
    228         return ApplicationManager.Manager.GetTypes(valueDataType, true);
     233        // otherwise use all assignable types
     234        return ApplicationManager.Manager.GetTypes(parameter.DataType, true);
    229235      }
    230236    }
     
    273279          return true;
    274280        }
    275         toCheck = toCheck.BaseType;
     281        toCheck = toCheck.BaseType; // baseType is null when toCheck is an Interface
     282        if (toCheck == null)
     283          return false;
    276284      }
    277285      return false;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/DoubleValueRange.cs

    r5207 r5337  
    2929    }
    3030
    31     public void ApplyStepSize(DoubleValue value) {
    32       value.Value = ((int)Math.Round(value.Value / this.StepSize.Value, 0)) * this.StepSize.Value;
     31    public double ApplyStepSize(double value) {
     32      return (Math.Round(value / this.StepSize.Value, 0)) * this.StepSize.Value;
    3333    }
    3434
     
    4444        solutions.Add(new DoubleValue(value));
    4545        value += StepSize.Value;
     46        value = ApplyStepSize(value);
    4647      }
    4748      return solutions;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/IntValueRange.cs

    r5207 r5337  
    2929    }
    3030
    31     public void ApplyStepSize(IntValue value) {
    32       value.Value = ((int)Math.Round(value.Value / (double)this.StepSize.Value, 0)) * this.StepSize.Value;
     31    public int ApplyStepSize(int value) {
     32      return ((int)Math.Round(value / (double)this.StepSize.Value, 0)) * this.StepSize.Value;
    3333    }
    3434
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/PercentValueRange.cs

    r5207 r5337  
    3333    }
    3434
    35     public void ApplyStepSize(PercentValue value) {
    36       value.Value = ((int)Math.Round(value.Value / this.StepSize.Value, 0)) * this.StepSize.Value;
     35    public double ApplyStepSize(double value) {
     36      return ((int)Math.Round(value / this.StepSize.Value, 0)) * this.StepSize.Value;
    3737    }
    3838
     
    4848        solutions.Add(new PercentValue(value));
    4949        value += StepSize.Value;
     50        value = ApplyStepSize(value);
    5051      }
    5152      return solutions;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmExecutor.cs

    r5281 r5337  
    1111  /// </summary>
    1212  public class AlgorithmExecutor {
    13     private EngineAlgorithm algorithm;
     13    private IAlgorithm algorithm;
    1414    private AutoResetEvent waitHandle = new AutoResetEvent(false);
    1515
    16     public AlgorithmExecutor(EngineAlgorithm algorithm) {
     16    public AlgorithmExecutor(IAlgorithm algorithm) {
    1717      this.algorithm = algorithm;
    1818    }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/ParameterConfigurationEvaluator.cs

    r5313 r5337  
    3030      get { return (ILookupParameter<TypeValue>)Parameters[MetaOptimizationProblem.AlgorithmTypeParameterName]; }
    3131    }
    32     public ILookupParameter<IItemList<ISingleObjectiveProblem>> ProblemsParameter {
    33       get { return (ILookupParameter<IItemList<ISingleObjectiveProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
     32    public ILookupParameter<IItemList<IProblem>> ProblemsParameter {
     33      get { return (ILookupParameter<IItemList<IProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
    3434    }
    3535    public ILookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter {
     
    5858      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The evaluated quality of the ParameterVector."));
    5959      Parameters.Add(new LookupParameter<TypeValue>(MetaOptimizationProblem.AlgorithmTypeParameterName, "Missing description."));
    60       Parameters.Add(new LookupParameter<IItemList<ISingleObjectiveProblem>>(MetaOptimizationProblem.ProblemsParameterName, "Missing description."));
     60      Parameters.Add(new LookupParameter<IItemList<IProblem>>(MetaOptimizationProblem.ProblemsParameterName, "Missing description."));
    6161      Parameters.Add(new LookupParameter<ParameterConfigurationTree>("ParameterConfigurationTree", "Missing description."));
    6262      Parameters.Add(new LookupParameter<IntValue>(MetaOptimizationProblem.RepetitionsParameterName, "Number of evaluations on one problem."));
     
    7777    public override IOperation Apply() {
    7878      ParameterConfigurationTree parameterConfiguration = ParameterConfigurationParameter.ActualValue;
    79       EngineAlgorithm algorithm = (EngineAlgorithm)Activator.CreateInstance(AlgorithmTypeParameter.ActualValue.Value);
    80       IItemList<ISingleObjectiveProblem> problems = ProblemsParameter.ActualValue;
     79      IAlgorithm algorithm = (IAlgorithm)Activator.CreateInstance(AlgorithmTypeParameter.ActualValue.Value);
     80      IItemList<IProblem> problems = ProblemsParameter.ActualValue;
    8181      ItemDictionary<StringValue, RunCollection> runsCache = ResultsParameter.ActualValue.ContainsKey("Runs") ? (ItemDictionary<StringValue, RunCollection>)ResultsParameter.ActualValue["Runs"].Value : null;
    8282      double[] referenceQualities = GetReferenceQualities(problems);
     
    113113    }
    114114
    115     private double[] GetReferenceQualities(IItemList<ISingleObjectiveProblem> problems) {
     115    private double[] GetReferenceQualities(IItemList<IProblem> problems) {
    116116      double[] referenceQualities;
    117117      if (ProblemQualityReferencesParameter.ActualValue == null) {
     
    127127    }
    128128
    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();
    131131
    132132      // set parameters
     
    134134      algorithmClone.StoreAlgorithmInEachRun = false;
    135135
    136       algorithmClone.Engine = new SequentialEngine.SequentialEngine();
     136      if (algorithmClone is EngineAlgorithm) {
     137        ((EngineAlgorithm)algorithmClone).Engine = new SequentialEngine.SequentialEngine();
     138      }
    137139      algorithmClone.Prepare(true);
    138140
    139       foreach (ISingleObjectiveProblem problem in problems) {
     141      foreach (IProblem problem in problems) {
    140142        algorithmClone.Problem = (IProblem)problem.Clone();
    141143
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs

    r5328 r5337  
    4949
    5050    #region Parameter Properties
    51     public IValueParameter<ConstrainedTypeValue<EngineAlgorithm>> AlgorithmTypeParameter {
    52       get { return (ValueParameter<ConstrainedTypeValue<EngineAlgorithm>>)Parameters[AlgorithmTypeParameterName]; }
    53     }
    54     public IValueParameter<ConstrainedTypeValue<ISingleObjectiveProblem>> ProblemTypeParameter {
    55       get { return (ValueParameter<ConstrainedTypeValue<ISingleObjectiveProblem>>)Parameters[ProblemTypeParameterName]; }
    56     }
    57     public IValueParameter<ConstrainedItemList<ISingleObjectiveProblem>> ProblemsParameter {
    58       get { return (ValueParameter<ConstrainedItemList<ISingleObjectiveProblem>>)Parameters[ProblemsParameterName]; }
     51    public IValueParameter<ConstrainedTypeValue<IAlgorithm>> AlgorithmTypeParameter {
     52      get { return (ValueParameter<ConstrainedTypeValue<IAlgorithm>>)Parameters[AlgorithmTypeParameterName]; }
     53    }
     54    public IValueParameter<ConstrainedTypeValue<IProblem>> ProblemTypeParameter {
     55      get { return (ValueParameter<ConstrainedTypeValue<IProblem>>)Parameters[ProblemTypeParameterName]; }
     56    }
     57    public IValueParameter<ConstrainedItemList<IProblem>> ProblemsParameter {
     58      get { return (ValueParameter<ConstrainedItemList<IProblem>>)Parameters[ProblemsParameterName]; }
    5959    }
    6060    public IValueParameter<ParameterConfigurationTree> ParameterConfigurationTreeParameter {
     
    7575
    7676    #region Properties
    77     public EngineAlgorithm Algorithm {
     77    public IAlgorithm Algorithm {
    7878      get { return CreateAlgorithm(AlgorithmType.Value, ProblemType.Value); }
    7979    }
    80     public ConstrainedTypeValue<EngineAlgorithm> AlgorithmType {
     80    public ConstrainedTypeValue<IAlgorithm> AlgorithmType {
    8181      get { return AlgorithmTypeParameter.Value; }
    8282      set { AlgorithmTypeParameter.Value = value; }
    8383    }
    84     public ConstrainedTypeValue<ISingleObjectiveProblem> ProblemType {
     84    public ConstrainedTypeValue<IProblem> ProblemType {
    8585      get { return ProblemTypeParameter.Value; }
    8686      set { ProblemTypeParameter.Value = value; }
    8787    }
    88     public ConstrainedItemList<ISingleObjectiveProblem> Problems {
     88    public ConstrainedItemList<IProblem> Problems {
    8989      get { return ProblemsParameter.Value; }
    9090      set { ProblemsParameter.Value = value; }
     
    111111    public MetaOptimizationProblem()
    112112      : base() {
    113       Parameters.Add(new ValueParameter<ConstrainedTypeValue<EngineAlgorithm>>(AlgorithmTypeParameterName, "The algorithm which's parameters should be optimized.", new ConstrainedTypeValue<EngineAlgorithm>(typeof(GeneticAlgorithm))));
    114       Parameters.Add(new ValueParameter<ConstrainedTypeValue<ISingleObjectiveProblem>>(ProblemTypeParameterName, "The problem type.", new ConstrainedTypeValue<ISingleObjectiveProblem>(typeof(SingleObjectiveTestFunctionProblem))));
    115       Parameters.Add(new ValueParameter<ConstrainedItemList<ISingleObjectiveProblem>>(ProblemsParameterName, "The problems that should be evaluated.", new ConstrainedItemList<ISingleObjectiveProblem>()));
     113      Parameters.Add(new ValueParameter<ConstrainedTypeValue<IAlgorithm>>(AlgorithmTypeParameterName, "The algorithm which's parameters should be optimized.", new ConstrainedTypeValue<IAlgorithm>(typeof(GeneticAlgorithm))));
     114      Parameters.Add(new ValueParameter<ConstrainedTypeValue<IProblem>>(ProblemTypeParameterName, "The problem type.", new ConstrainedTypeValue<IProblem>()));
     115      Parameters.Add(new ValueParameter<ConstrainedItemList<IProblem>>(ProblemsParameterName, "The problems that should be evaluated.", new ConstrainedItemList<IProblem>()));
    116116      Parameters.Add(new ValueParameter<ParameterConfigurationTree>(ParameterConfigurationTreeParameterName, "Tree of algorithm parameters that should be optimized."));
    117117      Parameters.Add(new ValueParameter<IntValue>(RepetitionsParameterName, "The number of evaluations for each problem.", new IntValue(3)));
     
    137137      ParameterizeOperators();
    138138
    139       ProblemTypeParameter_ValueChanged(this, EventArgs.Empty);
     139      AlgorithmTypeParameter_ValueChanged(this, EventArgs.Empty);
    140140    }
    141141
     
    222222
    223223    private void AlgorithmType_ValueChanged(object sender, EventArgs e) {
     224      IAlgorithm instance = (IAlgorithm)Activator.CreateInstance(AlgorithmType.Value);
     225      this.ProblemType.ValidTypes = ApplicationManager.Manager.GetTypes(instance.ProblemType, true).ToList();
     226      this.ProblemType.Value = this.ProblemType.ValidTypes.First();
    224227      ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, ProblemType.Value));
    225228    }
     
    236239    #endregion
    237240
    238     private EngineAlgorithm CreateAlgorithm(Type algorithmType, Type problemType) {
    239       EngineAlgorithm algorithm = (EngineAlgorithm)Activator.CreateInstance(algorithmType);
     241    private IAlgorithm CreateAlgorithm(Type algorithmType, Type problemType) {
     242      IAlgorithm algorithm = (IAlgorithm)Activator.CreateInstance(algorithmType);
    240243      algorithm.Problem = (IProblem)Activator.CreateInstance(problemType);
    241244      return algorithm;
    242245    }
    243246
    244     public void ImportAlgorithm(EngineAlgorithm algorithm) {
     247    public void ImportAlgorithm(IAlgorithm algorithm) {
    245248      AlgorithmType.Value = algorithm.GetType();
    246       if(algorithm.Problem != null) ProblemType.Value = algorithm.Problem.GetType();
     249      if (algorithm.Problem != null) ProblemType.Value = algorithm.Problem.GetType();
    247250      ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(algorithm);
    248       if(algorithm.Problem != null) Problems.Add((ISingleObjectiveProblem)algorithm.Problem);
     251      if (algorithm.Problem != null) Problems.Add((IProblem)algorithm.Problem);
    249252    }
    250253  }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Crossovers/AverageDoubleValueCrossover.cs

    r5277 r5337  
    3434    public static void ApplyStatic(IRandom random, DoubleValue value, DoubleValue other, DoubleValueRange range) {
    3535      value.Value = (value.Value + other.Value) / 2;
    36       range.ApplyStepSize(value);
     36      value.Value = range.ApplyStepSize(value.Value);
    3737    }
    3838  }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Crossovers/NormalDoubleValueCrossover.cs

    r5293 r5337  
    3939      do {
    4040        offspring.Value = N.NextDouble();
    41         range.ApplyStepSize(offspring);
     41        offspring.Value = range.ApplyStepSize(offspring.Value);
    4242      } while (!range.IsInRange(offspring.Value));
    4343      return offspring;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Crossovers/NormalIntValueCrossover.cs

    r5293 r5337  
    3838      do {
    3939        offspring.Value = (int)N.NextDouble();
    40         range.ApplyStepSize(offspring);
     40        offspring.Value = range.ApplyStepSize(offspring.Value);
    4141      } while (!range.IsInRange(offspring.Value));
    4242      return offspring;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/NormalDoubleValueManipulator.cs

    r5293 r5337  
    4545        NormalAllPositionsManipulator.Apply(random, vector, strategy);
    4646        value.Value = vector[0];
    47         range.ApplyStepSize(value);
     47        value.Value = range.ApplyStepSize(value.Value);
    4848        ok = range.IsInRange(value.Value);
    4949      }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/NormalIntValueManipulator.cs

    r5293 r5337  
    4747        NormalAllPositionsManipulator.Apply(random, vector, strategy);
    4848        value.Value = (int)vector[0];
    49         range.ApplyStepSize(value);
     49        value.Value = range.ApplyStepSize(value.Value);
    5050        ok = range.IsInRange(value.Value);
    5151      }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/UniformDoubleValueManipulator.cs

    r5207 r5337  
    4747        UniformOnePositionManipulator.Apply(random, vector, bounds);
    4848        value.Value = vector[0];
    49         range.ApplyStepSize(value);
     49        value.Value = range.ApplyStepSize(value.Value);
    5050        ok = range.IsInRange(value.Value);
    5151      }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/UniformIntValueManipulator.cs

    r5207 r5337  
    4545        UniformOnePositionManipulator.Apply(random, vector, range.LowerBound, new IntValue(range.UpperBound.Value + 1));
    4646        value.Value = vector[0];
    47         range.ApplyStepSize(value);
     47        value.Value = range.ApplyStepSize(value.Value);
    4848        ok = range.IsInRange(value.Value);
    4949      }
Note: See TracChangeset for help on using the changeset viewer.