Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/13/12 17:14:53 (12 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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();
Note: See TracChangeset for help on using the changeset viewer.