Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3079


Ignore:
Timestamp:
03/17/10 02:01:26 (15 years ago)
Author:
abeham
Message:

fixed linkage in TS and LS similar to r3076 #898

Location:
trunk/sources
Files:
2 edited

Legend:

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

    r3078 r3079  
    254254          MoveEvaluatorParameter.ValidValues.Add(moveEvaluator);
    255255      }
    256       if (oldMoveMaker != null && MoveMakerParameter.ValidValues.Any(x => x.GetType() == oldMoveMaker.GetType()))
    257         MoveMaker = MoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveMaker.GetType());
    258       if (oldMoveEvaluator != null && MoveEvaluatorParameter.ValidValues.Any(x => x.GetType() == oldMoveEvaluator.GetType()))
    259         MoveEvaluator = MoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveEvaluator.GetType());
     256      if (oldMoveMaker != null) {
     257        IMoveMaker mm = MoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveMaker.GetType());
     258        if (mm != null) MoveMaker = mm;
     259      }
     260      if (oldMoveEvaluator != null) {
     261        ISingleObjectiveMoveEvaluator me = MoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveEvaluator.GetType());
     262        if (me != null) MoveEvaluator = me;
     263      }
    260264    }
    261265    private void ClearMoveParameters() {
  • trunk/sources/HeuristicLab.Algorithms.TS/3.3/TS.cs

    r3074 r3079  
    286286          TabuMoveMakerParameter.ValidValues.Add(tabuMoveMaker);
    287287      }
    288       if (oldMoveMaker != null && MoveMakerParameter.ValidValues.Any(x => x.GetType() == oldMoveMaker.GetType()))
    289         MoveMaker = MoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveMaker.GetType());
    290       if (oldMoveEvaluator != null && MoveEvaluatorParameter.ValidValues.Any(x => x.GetType() == oldMoveEvaluator.GetType()))
    291         MoveEvaluator = MoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveEvaluator.GetType());
    292       if (oldTabuMoveMaker != null && TabuMoveMakerParameter.ValidValues.Any(x => x.GetType() == oldTabuMoveMaker.GetType()))
    293         TabuMoveMaker = TabuMoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldTabuMoveMaker.GetType());
    294       if (oldTabuMoveEvaluator != null && TabuMoveEvaluatorParameter.ValidValues.Any(x => x.GetType() == oldTabuMoveEvaluator.GetType()))
    295         TabuMoveEvaluator = TabuMoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldTabuMoveEvaluator.GetType());
     288      if (oldMoveMaker != null) {
     289        IMoveMaker mm = MoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveMaker.GetType());
     290        if (mm != null) MoveMaker = mm;
     291      }
     292      if (oldMoveEvaluator != null) {
     293        ISingleObjectiveMoveEvaluator me = MoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveEvaluator.GetType());
     294        if (me != null) MoveEvaluator = me;
     295      }
     296      if (oldTabuMoveMaker != null) {
     297        ITabuMoveMaker tmm = TabuMoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldTabuMoveMaker.GetType());
     298        if (tmm != null) TabuMoveMaker = tmm;
     299      }
     300      if (oldTabuMoveEvaluator != null) {
     301        ITabuMoveEvaluator tme = TabuMoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldTabuMoveEvaluator.GetType());
     302        if (tme != null) TabuMoveEvaluator = tme;
     303      }
    296304    }
    297305    private void ClearMoveParameters() {
Note: See TracChangeset for help on using the changeset viewer.