Changeset 11424


Ignore:
Timestamp:
10/08/14 07:31:33 (5 years ago)
Author:
abeham
Message:

#2174: fixed a casting bug and bugs regarding the parameterization of move operators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProgrammableProblem.cs

    r11405 r11424  
    280280        #endregion
    281281        #region Wire BinaryVector ShakingOperators
    282         Operators.RemoveAll(x => x is IBinaryVectorMultiNeighborhoodShakingOperator && ((IBinaryVectorManipulator)x).BinaryVectorParameter.ActualName != paramName);
     282        Operators.RemoveAll(x => x is IBinaryVectorMultiNeighborhoodShakingOperator && ((IBinaryVectorMultiNeighborhoodShakingOperator)x).BinaryVectorParameter.ActualName != paramName);
    283283        var shakingOperators = ApplicationManager.Manager.GetInstances<IBinaryVectorMultiNeighborhoodShakingOperator>().ToList();
    284284        foreach (var so in shakingOperators) {
     
    865865
    866866    protected virtual void UpdateMoveOperators() {
    867       Operators.RemoveAll(x => x is IParameterVectorMoveOperator);
    868       var generator = new ParameterVectorMoveGenerator();
    869       generator.ConfigurationParameter.ActualName = ConfigurationParameter.Name;
    870       generator.ProblemDefinitionParameter.ActualName = ProblemDefinitionParameter.Name;
    871 
    872       var evaluator = new ParameterVectorMoveEvaluator();
    873       evaluator.ConfigurationParameter.ActualName = ConfigurationParameter.Name;
    874       evaluator.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    875       evaluator.ProblemDefinitionParameter.ActualName = ProblemDefinitionParameter.Name;
    876 
    877       var maker = new ParameterVectorMoveMaker();
    878       maker.ConfigurationParameter.ActualName = ConfigurationParameter.Name;
    879       maker.MoveQualityParameter.ActualName = evaluator.MoveQualityParameter.ActualName;
    880       maker.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    881 
    882       Operators.AddRange(new IItem[] { generator, evaluator, maker });
     867      if (!Operators.Any(x => x is ParameterVectorMoveGenerator))
     868        Operators.Add(new ParameterVectorMoveGenerator());
     869      if (!Operators.Any(x => x is ParameterVectorMoveEvaluator))
     870        Operators.Add(new ParameterVectorMoveEvaluator());
     871      if (!Operators.Any(x => x is ParameterVectorMoveMaker))
     872        Operators.Add(new ParameterVectorMoveMaker());
     873
     874      foreach (var generator in Operators.OfType<ParameterVectorMoveGenerator>()) {
     875        generator.ConfigurationParameter.ActualName = ConfigurationParameter.Name;
     876        generator.ProblemDefinitionParameter.ActualName = ProblemDefinitionParameter.Name;
     877      }
     878      foreach (var evaluator in Operators.OfType<ParameterVectorMoveEvaluator>()) {
     879        evaluator.ConfigurationParameter.ActualName = ConfigurationParameter.Name;
     880        evaluator.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
     881        evaluator.ProblemDefinitionParameter.ActualName = ProblemDefinitionParameter.Name;
     882      }
     883      foreach (var maker in Operators.OfType<ParameterVectorMoveMaker>()) {
     884        maker.ConfigurationParameter.ActualName = ConfigurationParameter.Name;
     885        maker.MoveQualityParameter.ActualName = Operators.OfType<ParameterVectorMoveEvaluator>().First().MoveQualityParameter.ActualName;
     886        maker.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
     887      }
    883888    }
    884889
Note: See TracChangeset for help on using the changeset viewer.