Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3099


Ignore:
Timestamp:
03/18/10 11:56:42 (15 years ago)
Author:
abeham
Message:

extended name change of move parameter to all operators not just all except move generators #898

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TSP/3.3/TSP.cs

    r3080 r3099  
    202202      string name = ((ILookupParameter<TwoOptMove>)sender).ActualName;
    203203      foreach (ITwoOptPermutationMoveOperator op in Operators.OfType<ITwoOptPermutationMoveOperator>()) {
    204         if (!(op is IMoveGenerator)) op.TwoOptMoveParameter.ActualName = name;
     204        op.TwoOptMoveParameter.ActualName = name;
    205205      }
    206206    }
     
    208208      string name = ((ILookupParameter<ThreeOptMove>)sender).ActualName;
    209209      foreach (IThreeOptPermutationMoveOperator op in Operators.OfType<IThreeOptPermutationMoveOperator>()) {
    210         if (!(op is IMoveGenerator)) op.ThreeOptMoveParameter.ActualName = name;
     210        op.ThreeOptMoveParameter.ActualName = name;
    211211      }
    212212    }
     
    224224      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
    225225    }
     226    private void InitializeOperators() {
     227      operators = new List<IPermutationOperator>();
     228      if (ApplicationManager.Manager != null) {
     229        operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>());
     230        ParameterizeOperators();
     231      }
     232      InitializeMoveGenerators();
     233    }
     234    private void InitializeMoveGenerators() {
     235      foreach (ITwoOptPermutationMoveOperator op in Operators.OfType<ITwoOptPermutationMoveOperator>()) {
     236        if (op is IMoveGenerator) {
     237          op.TwoOptMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_TwoOptMoveParameter_ActualNameChanged);
     238        }
     239      }
     240      foreach (IThreeOptPermutationMoveOperator op in Operators.OfType<IThreeOptPermutationMoveOperator>()) {
     241        if (op is IMoveGenerator) {
     242          op.ThreeOptMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_ThreeOptMoveParameter_ActualNameChanged);
     243        }
     244      }
     245    }
    226246    private void ParameterizeSolutionCreator() {
    227247      SolutionCreator.LengthParameter.Value = new IntValue(Coordinates.Rows);
     
    237257      }
    238258    }
    239     private void InitializeOperators() {
    240       operators = new List<IPermutationOperator>();
    241       if (ApplicationManager.Manager != null) {
    242         operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>());
    243         ParameterizeOperators();
    244       }
    245       InitializeMoveGenerators();
    246     }
    247259    private void ParameterizeOperators() {
    248260      foreach (IPermutationCrossover op in Operators.OfType<IPermutationCrossover>()) {
     
    262274      }
    263275    }
    264     private void InitializeMoveGenerators() {
    265       foreach (ITwoOptPermutationMoveOperator op in Operators.OfType<ITwoOptPermutationMoveOperator>()) {
    266         if (op is IMoveGenerator) {
    267           op.TwoOptMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_TwoOptMoveParameter_ActualNameChanged);
    268         }
    269       }
    270       foreach (IThreeOptPermutationMoveOperator op in Operators.OfType<IThreeOptPermutationMoveOperator>()) {
    271         if (op is IMoveGenerator) {
    272           op.ThreeOptMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_ThreeOptMoveParameter_ActualNameChanged);
    273         }
    274       }
    275     }
    276276
    277277    private void ClearDistanceMatrix() {
Note: See TracChangeset for help on using the changeset viewer.