Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Crossovers/MultiIntValueCrossover.cs @ 5653

Last change on this file since 5653 was 5653, checked in by cneumuel, 13 years ago

#1215

  • evaluation operator returns operatorgraph which creates a scope and an operation for each algorithm execution (each repetition and problem)
  • split ValueConfiguration into ParameterizedValueConfiguration and RangeValueConfiguration
File size: 1.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Operators;
6using HeuristicLab.Optimization;
7using HeuristicLab.PluginInfrastructure;
8using HeuristicLab.Data;
9using HeuristicLab.Core;
10using HeuristicLab.Common;
11using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
12
13namespace HeuristicLab.Problems.MetaOptimization.Operators.Crossovers {
14  [Item("MultiIntValueCrossover", "Randomly selects and applies one of its crossovers every time it is called.")]
15  [StorableClass]
16  public class MultiIntValueCrossover : StochasticMultiBranch<IIntValueCrossover>, IIntValueCrossover, IStochasticOperator {
17    public override bool CanChangeName {
18      get { return false; }
19    }
20    protected override bool CreateChildOperation {
21      get { return true; }
22    }
23
24    [StorableConstructor]
25    protected MultiIntValueCrossover(bool deserializing) : base(deserializing) { }
26    public MultiIntValueCrossover() {
27      foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IIntValueCrossover)).OrderBy(op => op.Name)) {
28        if (!typeof(MultiOperator<IIntValueCrossover>).IsAssignableFrom(type))
29          Operators.Add((IIntValueCrossover)Activator.CreateInstance(type), true);
30      }
31    }
32    protected MultiIntValueCrossover(MultiIntValueCrossover original, Cloner cloner) : base(original, cloner) {
33    }
34    public override IDeepCloneable Clone(Cloner cloner) {
35      return new MultiIntValueCrossover(this, cloner);
36    }
37
38    public override IOperation Apply() {
39      if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one permutation crossover to choose from.");
40      return base.Apply();
41    }
42
43    public void Apply(IRandom random, IntValue value, IntValue other, IntValueRange range) {
44
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.