protected QAPExhaustiveSwap2LocalImprovement(QAPExhaustiveSwap2LocalImprovement original, Cloner cloner) : base(original, cloner) { }
private void ParameterizeOperators() { foreach (IPermutationCrossover op in Operators.OfType <IPermutationCrossover>()) { op.ParentsParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; op.ChildParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; } foreach (IPermutationManipulator op in Operators.OfType <IPermutationManipulator>()) { op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; } foreach (IPermutationMoveOperator op in Operators.OfType <IPermutationMoveOperator>()) { op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; } if (Operators.OfType <IMoveGenerator>().Any()) { if (Operators.OfType <IMoveGenerator>().OfType <IPermutationInversionMoveOperator>().Any()) { string inversionMove = Operators.OfType <IMoveGenerator>().OfType <IPermutationInversionMoveOperator>().First().InversionMoveParameter.ActualName; foreach (IPermutationInversionMoveOperator op in Operators.OfType <IPermutationInversionMoveOperator>()) { op.InversionMoveParameter.ActualName = inversionMove; } } if (Operators.OfType <IMoveGenerator>().OfType <IPermutationTranslocationMoveOperator>().Any()) { string translocationMove = Operators.OfType <IMoveGenerator>().OfType <IPermutationTranslocationMoveOperator>().First().TranslocationMoveParameter.ActualName; foreach (IPermutationTranslocationMoveOperator op in Operators.OfType <IPermutationTranslocationMoveOperator>()) { op.TranslocationMoveParameter.ActualName = translocationMove; } } if (Operators.OfType <IMoveGenerator>().OfType <IPermutationSwap2MoveOperator>().Any()) { string swapMove = Operators.OfType <IMoveGenerator>().OfType <IPermutationSwap2MoveOperator>().First().Swap2MoveParameter.ActualName; foreach (IPermutationSwap2MoveOperator op in Operators.OfType <IPermutationSwap2MoveOperator>()) { op.Swap2MoveParameter.ActualName = swapMove; } } } foreach (var op in Operators.OfType <IPermutationMultiNeighborhoodShakingOperator>()) { op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; } QAPExhaustiveSwap2LocalImprovement localOpt = Operators.OfType <QAPExhaustiveSwap2LocalImprovement>().SingleOrDefault(); if (localOpt != null) { localOpt.AssignmentParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; localOpt.DistancesParameter.ActualName = DistancesParameter.Name; localOpt.MaximizationParameter.ActualName = MaximizationParameter.Name; localOpt.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; localOpt.WeightsParameter.ActualName = WeightsParameter.Name; } foreach (var similarityCalculator in Operators.OfType <ISolutionSimilarityCalculator>()) { similarityCalculator.SolutionVariableName = SolutionCreator.PermutationParameter.ActualName; similarityCalculator.QualityVariableName = Evaluator.QualityParameter.ActualName; var qapsimcalc = similarityCalculator as QAPSimilarityCalculator; if (qapsimcalc != null) { qapsimcalc.Weights = Weights; qapsimcalc.Distances = Distances; } } }
protected QAPExhaustiveSwap2LocalImprovement(QAPExhaustiveSwap2LocalImprovement original, Cloner cloner) : base(original, cloner) { }