Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7768


Ignore:
Timestamp:
04/30/12 00:01:14 (13 years ago)
Author:
abeham
Message:

#1722

  • Added a check before parameterizing operators if there are any in the collection
File:
1 edited

Legend:

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

    r7641 r7768  
    322322      }
    323323      if (Operators.OfType<IMoveGenerator>().Any()) {
    324         string inversionMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationInversionMoveOperator>().First().InversionMoveParameter.ActualName;
    325         foreach (IPermutationInversionMoveOperator op in Operators.OfType<IPermutationInversionMoveOperator>())
    326           op.InversionMoveParameter.ActualName = inversionMove;
    327         string translocationMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationTranslocationMoveOperator>().First().TranslocationMoveParameter.ActualName;
    328         foreach (IPermutationTranslocationMoveOperator op in Operators.OfType<IPermutationTranslocationMoveOperator>())
    329           op.TranslocationMoveParameter.ActualName = translocationMove;
    330         string swapMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationSwap2MoveOperator>().First().Swap2MoveParameter.ActualName;
    331         foreach (IPermutationSwap2MoveOperator op in Operators.OfType<IPermutationSwap2MoveOperator>()) {
    332           op.Swap2MoveParameter.ActualName = swapMove;
     324        if (Operators.OfType<IMoveGenerator>().OfType<IPermutationInversionMoveOperator>().Any()) {
     325          string inversionMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationInversionMoveOperator>().First().InversionMoveParameter.ActualName;
     326          foreach (IPermutationInversionMoveOperator op in Operators.OfType<IPermutationInversionMoveOperator>())
     327            op.InversionMoveParameter.ActualName = inversionMove;
     328        }
     329        if (Operators.OfType<IMoveGenerator>().OfType<IPermutationTranslocationMoveOperator>().Any()) {
     330          string translocationMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationTranslocationMoveOperator>().First().TranslocationMoveParameter.ActualName;
     331          foreach (IPermutationTranslocationMoveOperator op in Operators.OfType<IPermutationTranslocationMoveOperator>())
     332            op.TranslocationMoveParameter.ActualName = translocationMove;
     333        }
     334        if (Operators.OfType<IMoveGenerator>().OfType<IPermutationSwap2MoveOperator>().Any()) {
     335          string swapMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationSwap2MoveOperator>().First().Swap2MoveParameter.ActualName;
     336          foreach (IPermutationSwap2MoveOperator op in Operators.OfType<IPermutationSwap2MoveOperator>()) {
     337            op.Swap2MoveParameter.ActualName = swapMove;
     338          }
    333339        }
    334340      }
Note: See TracChangeset for help on using the changeset viewer.