Changeset 7999


Ignore:
Timestamp:
06/13/12 17:14:53 (7 years ago)
Author:
ascheibe
Message:

#1864

  • switched IOperators collection to IItems
  • adapted algorithms and problems
  • added AfterDeserialization hooks for problem, external evaluation problem and user-defined problem
Location:
trunk/sources
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs

    r7509 r7999  
    227227      ParameterizeStochasticOperator(Problem.SolutionCreator);
    228228      ParameterizeStochasticOperator(Problem.Evaluator);
    229       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     229      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    230230      ParameterizeSolutionsCreator();
    231231      ParameterizeGeneticAlgorithmMainLoop();
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r7524 r7999  
    326326      ParameterizeStochasticOperator(Problem.SolutionCreator);
    327327      ParameterizeStochasticOperator(Problem.Evaluator);
    328       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     328      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    329329      ParameterizeSolutionsCreator();
    330330      ParameterizeMainLoop();
     
    354354    }
    355355    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    356       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     356      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    357357      ParameterizeIterationBasedOperators();
    358358      UpdateCrossovers();
  • trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearch.cs

    r7510 r7999  
    203203      ParameterizeStochasticOperator(Problem.SolutionCreator);
    204204      ParameterizeStochasticOperator(Problem.Evaluator);
    205       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     205      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    206206      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
    207207        op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
  • trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchImprovementOperator.cs

    r7259 r7999  
    292292      if (MoveGenerator != null && Problem != null) {
    293293        IMoveGenerator generator = MoveGeneratorParameter.Value;
    294         foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators).OrderBy(x => x.Name))
     294        foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name))
    295295          MoveMakerParameter.ValidValues.Add(moveMaker);
    296         foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators).OrderBy(x => x.Name))
     296        foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name))
    297297          MoveEvaluatorParameter.ValidValues.Add(moveEvaluator);
    298298
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2.cs

    r7511 r7999  
    244244      ParameterizeStochasticOperator(Problem.SolutionCreator);
    245245      ParameterizeStochasticOperator(Problem.Evaluator);
    246       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     246      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    247247      ParameterizeSolutionsCreator();
    248248      ParameterizeRankAndCrowdingSorter();
     
    273273    }
    274274    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    275       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     275      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    276276      ParameterizeIterationBasedOperators();
    277277      UpdateCrossovers();
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs

    r7511 r7999  
    408408      ParameterizeStochasticOperator(Problem.SolutionCreator);
    409409      ParameterizeStochasticOperator(Problem.Evaluator);
    410       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     410      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    411411      ParameterizeSolutionsCreator();
    412412      ParameterizeMainLoop();
     
    436436    }
    437437    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    438       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     438      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    439439      ParameterizeIterationBasedOperators();
    440440      UpdateCrossovers();
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r7609 r7999  
    316316      ParameterizeStochasticOperator(Problem.SolutionCreator);
    317317      ParameterizeStochasticOperator(Problem.Evaluator);
    318       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     318      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    319319      ParameterizeSolutionsCreator();
    320320      ParameterizMainLoop();
     
    344344    }
    345345    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    346       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     346      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    347347      ParameterizeIterationBasedOperators();
    348348      UpdateCrossovers();
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r7259 r7999  
    367367      ParameterizeStochasticOperator(Problem.SolutionCreator);
    368368      ParameterizeStochasticOperator(Problem.Evaluator);
    369       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     369      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    370370      ParameterizeSolutionsCreator();
    371371      ParameterizeMainLoop();
     
    395395    }
    396396    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    397       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     397      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    398398      ParameterizeIterationBasedOperators();
    399399      UpdateCrossovers();
  • trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r7517 r7999  
    233233      ParameterizeStochasticOperator(Problem.SolutionCreator);
    234234      ParameterizeStochasticOperator(Problem.Evaluator);
    235       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     235      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    236236      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
    237237        op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
     
    266266    }
    267267    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    268       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     268      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    269269      // This may seem pointless, but some operators already have the eventhandler registered, others don't
    270270      // FIXME: Is there another way to solve this problem?
  • trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingImprovementOperator.cs

    r7259 r7999  
    316316      if (MoveGenerator != null) {
    317317        IMoveGenerator generator = MoveGeneratorParameter.Value;
    318         foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators).OrderBy(x => x.Name))
     318        foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name))
    319319          MoveMakerParameter.ValidValues.Add(moveMaker);
    320         foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators).OrderBy(x => x.Name))
     320        foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name))
    321321          MoveEvaluatorParameter.ValidValues.Add(moveEvaluator);
    322322
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs

    r7516 r7999  
    230230      ParameterizeStochasticOperator(Problem.SolutionCreator);
    231231      ParameterizeStochasticOperator(Problem.Evaluator);
    232       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     232      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    233233      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
    234234        op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
     
    270270    }
    271271    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    272       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     272      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    273273      // This may seem pointless, but some operators already have the eventhandler registered, others don't
    274274      // FIXME: Is there another way to solve this problem?
  • trunk/sources/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearch.cs

    r7518 r7999  
    212212      ParameterizeStochasticOperator(Problem.SolutionCreator);
    213213      ParameterizeStochasticOperator(Problem.Evaluator);
    214       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     214      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    215215      ParameterizeSolutionsCreator();
    216216      ParameterizeMainLoop();
     
    237237      UpdateShakingOperators();
    238238      UpdateAnalyzers();
    239       foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     239      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
    240240      ParameterizeIterationBasedOperators();
    241241      base.Problem_OperatorsChanged(sender, e);
  • trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IProblem.cs

    r7259 r7999  
    2929  /// </summary>
    3030  public interface IProblem : IParameterizedNamedItem {
    31     IEnumerable<IOperator> Operators { get; }
     31    IEnumerable<IItem> Operators { get; }
    3232
    3333    event EventHandler OperatorsChanged;
  • trunk/sources/HeuristicLab.Optimization/3.3/Problems/Problem.cs

    r7706 r7999  
    3535  public abstract class Problem : ParameterizedNamedItem, IProblem {
    3636    private static readonly string OperatorsParameterName = "Operators";
    37 
    38     public IFixedValueParameter<OperatorCollection> OperatorsParameter {
    39       get { return (IFixedValueParameter<OperatorCollection>)Parameters[OperatorsParameterName]; }
     37    public IFixedValueParameter<ItemCollection<IItem>> OperatorsParameter {
     38      get { return (IFixedValueParameter<ItemCollection<IItem>>)Parameters[OperatorsParameterName]; }
    4039    }
    4140
     
    5352    protected Problem()
    5453      : base() {
    55       Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(), false));
     54      Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(), false));
    5655      OperatorsParameter.Hidden = true;
    5756      RegisterEventHandlers();
     
    6059    [StorableHook(HookType.AfterDeserialization)]
    6160    private void AfterDeserialization() {
     61      // BackwardsCompatibility3.3
     62      #region Backwards compatible code, remove with 3.4
     63      if (Parameters.ContainsKey(OperatorsParameterName) && Parameters[OperatorsParameterName] is FixedValueParameter<OperatorCollection>) {
     64        OperatorCollection tmp = ((IFixedValueParameter<OperatorCollection>)Parameters[OperatorsParameterName]).Value;
     65        Parameters.Remove(OperatorsParameterName);
     66        Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(tmp), false));       
     67        OperatorsParameter.Hidden = true;
     68      }
     69      #endregion
     70
    6271      RegisterEventHandlers();
    6372    }
    6473
    6574    private void RegisterEventHandlers() {
    66       Operators.ItemsAdded += new CollectionItemsChangedEventHandler<IOperator>(Operators_Changed);
    67       Operators.ItemsRemoved += new CollectionItemsChangedEventHandler<IOperator>(Operators_Changed);
    68       Operators.CollectionReset += new CollectionItemsChangedEventHandler<IOperator>(Operators_Changed);
     75      Operators.ItemsAdded += new CollectionItemsChangedEventHandler<IItem>(Operators_Changed);
     76      Operators.ItemsRemoved += new CollectionItemsChangedEventHandler<IItem>(Operators_Changed);
     77      Operators.CollectionReset += new CollectionItemsChangedEventHandler<IItem>(Operators_Changed);
    6978    }
    7079
     
    7281    // BackwardsCompatibility3.3
    7382    #region Backwards compatible code, remove with 3.4
    74     [Storable(Name = "Operators")]
     83    [Storable(Name = "Operators", AllowOneWay = true)]
    7584    private IEnumerable<IOperator> StorableOperators {
    76       get { return null; }
    7785      set {
    7886        if (!Parameters.ContainsKey(OperatorsParameterName)) {
    79           Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(value), false));
     87          Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(value), false));
    8088          OperatorsParameter.Hidden = true;
    8189        }
     
    8391    }
    8492    #endregion
    85     protected OperatorCollection Operators {
     93    protected ItemCollection<IItem> Operators {
    8694      get {
    8795        // BackwardsCompatibility3.3
    8896        #region Backwards compatible code, remove with 3.4
    8997        if (!Parameters.ContainsKey(OperatorsParameterName)) {
    90           Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(), false));
     98          Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(), false));
    9199          OperatorsParameter.Hidden = true;
    92100        }
     
    95103      }
    96104    }
    97     IEnumerable<IOperator> IProblem.Operators { get { return Operators; } }
     105    IEnumerable<IItem> IProblem.Operators { get { return Operators; } }
    98106    #endregion
    99107
  • trunk/sources/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs

    r7351 r7999  
    8181      get { return (OptionalValueParameter<IScope>)Parameters["BestKnownSolution"]; }
    8282    }
    83     public ValueParameter<ItemList<IOperator>> OperatorsParameter {
    84       get { return (ValueParameter<ItemList<IOperator>>)Parameters["Operators"]; }
     83    public ValueParameter<ItemList<IItem>> OperatorsParameter {
     84      get { return (ValueParameter<ItemList<IItem>>)Parameters["Operators"]; }
    8585    }
    8686    #endregion
     
    112112      set { BestKnownQualityParameter.Value = value; }
    113113    }
    114     public IEnumerable<IOperator> Operators {
     114    public IEnumerable<IItem> Operators {
    115115      get { return OperatorsParameter.Value; }
    116116    }
     
    121121    [StorableHook(HookType.AfterDeserialization)]
    122122    private void AfterDeserialization() {
     123      // BackwardsCompatibility3.3
     124      #region Backwards compatible code, remove with 3.4
     125      if (Parameters.ContainsKey("Operators") && Parameters["Operators"] is ValueParameter<ItemList<IOperator>>) {
     126        ItemList<IOperator> tmp = ((ValueParameter<ItemList<IOperator>>)Parameters["Operators"]).Value;
     127        Parameters.Remove("Operators");
     128        Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp), false));
     129      }
     130      #endregion
     131
    123132      RegisterEventHandlers();
    124133    }
     
    130139      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem."));
    131140      Parameters.Add(new OptionalValueParameter<IScope>("BestKnownSolution", "The best known solution for this external evaluation problem."));
    132       Parameters.Add(new ValueParameter<ItemList<IOperator>>("Operators", "The operators that are passed to the algorithm.", new ItemList<IOperator>()));
     141      Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>()));
    133142
    134143      RegisterEventHandlers();
     
    200209        Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    201210      OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged);
    202       OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsAdded);
    203       OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsRemoved);
    204       OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_CollectionReset);
     211      OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsAdded);
     212      OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsRemoved);
     213      OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_CollectionReset);
    205214    }
    206215
     
    209218      if (Evaluator != null) {
    210219        string qualityName = Evaluator.QualityParameter.ActualName;
    211         foreach (IOperator op in OperatorsParameter.Value) {
     220        foreach (IOperator op in OperatorsParameter.Value.OfType<IOperator>()) {
    212221          foreach (ILookupParameter<DoubleValue> param in op.Parameters.OfType<ILookupParameter<DoubleValue>>()) {
    213222            if (param.Name.Equals("Quality")) param.ActualName = qualityName;
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs

    r7351 r7999  
    8383      get { return (OptionalValueParameter<IScope>)Parameters["BestKnownSolution"]; }
    8484    }
    85     public ValueParameter<ItemList<IOperator>> OperatorsParameter {
    86       get { return (ValueParameter<ItemList<IOperator>>)Parameters["Operators"]; }
     85    public ValueParameter<ItemList<IItem>> OperatorsParameter {
     86      get { return (ValueParameter<ItemList<IItem>>)Parameters["Operators"]; }
    8787    }
    8888    public OptionalValueParameter<EvaluationCache> CacheParameter {
     
    117117      set { BestKnownQualityParameter.Value = value; }
    118118    }
    119     public IEnumerable<IOperator> Operators {
     119    public IEnumerable<IItem> Operators {
    120120      get { return OperatorsParameter.Value; }
    121121    }
     
    145145      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem."));
    146146      Parameters.Add(new OptionalValueParameter<IScope>("BestKnownSolution", "The best known solution for this external evaluation problem."));
    147       Parameters.Add(new ValueParameter<ItemList<IOperator>>("Operators", "The operators that are passed to the algorithm.", new ItemList<IOperator>()));
     147      Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>()));
    148148      Parameters.Add(new OptionalValueParameter<EvaluationCache>("Cache", "Cache of previously evaluated solutions."));
    149149
     
    164164        }
    165165      }
     166
     167      if (Parameters.ContainsKey("Operators") && Parameters["Operators"] is ValueParameter<ItemList<IOperator>>) {
     168        ItemList<IOperator> tmp = ((ValueParameter<ItemList<IOperator>>)Parameters["Operators"]).Value;
     169        Parameters.Remove("Operators");
     170        Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp), false));
     171      }
    166172      #endregion
    167173      RegisterEventHandlers();
     
    221227      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    222228      OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged);
    223       OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsAdded);
    224       OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_ItemsRemoved);
    225       OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOperator>>(OperatorsParameter_Value_CollectionReset);
     229      OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsAdded);
     230      OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsRemoved);
     231      OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_CollectionReset);
    226232    }
    227233    private void InitializeOperators() {
    228       ItemList<IOperator> operators = OperatorsParameter.Value;
     234      ItemList<IItem> operators = OperatorsParameter.Value;
    229235      operators.Add(new BestScopeSolutionAnalyzer());
    230236      ParameterizeAnalyzers();
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs

    r7934 r7999  
    110110
    111111    [Storable]
    112     private List<IOperator> operators;
    113 
    114     public IEnumerable<IOperator> Operators {
     112    private List<IItem> operators;
     113
     114    public IEnumerable<IItem> Operators {
    115115      get { return operators; }
    116116    }
     
    131131      EvaluatorParameter.Hidden = true;
    132132
    133       operators = new List<IOperator>();
     133      operators = new List<IItem>();
    134134
    135135      InitializeRandomVRPInstance();
     
    147147    private VehicleRoutingProblem(VehicleRoutingProblem original, Cloner cloner)
    148148      : base(original, cloner) {
    149       this.operators = original.operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
     149      this.operators = original.operators.Select(x => (IItem)cloner.Clone(x)).ToList();
    150150      this.AttachEventHandlers();
    151151    }
     
    254254
    255255    private void InitializeOperators() {
    256       operators = new List<IOperator>();
     256      operators = new List<IItem>();
    257257
    258258      if (ProblemInstance != null) {
     
    267267    private void ParameterizeSolutionCreator() {
    268268      if (SolutionCreator is IMultiVRPOperator) {
    269         (SolutionCreator as IMultiVRPOperator).SetOperators(Operators);
     269        (SolutionCreator as IMultiVRPOperator).SetOperators(Operators.OfType<IOperator>());
    270270      }
    271271    }
    272272
    273273    private void ParameterizeOperators() {
    274       foreach (IOperator op in Operators) {
     274      foreach (IOperator op in Operators.OfType<IOperator>()) {
    275275        if (op is IMultiVRPOperator) {
    276           (op as IMultiVRPOperator).SetOperators(Operators);
     276          (op as IMultiVRPOperator).SetOperators(Operators.OfType<IOperator>());
    277277        }
    278278      }
Note: See TracChangeset for help on using the changeset viewer.