Changeset 17698 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/LocalImprovement/AlbaLambdaInterchangeLocalImprovementOperator.cs
- Timestamp:
- 07/24/20 00:58:42 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/LocalImprovement/AlbaLambdaInterchangeLocalImprovementOperator.cs
r17226 r17698 45 45 } 46 46 47 public ILookupParameter<IVRPEncod ing> VRPToursParameter {48 get { return (ILookupParameter<IVRPEncod ing>)Parameters["VRPTours"]; }47 public ILookupParameter<IVRPEncodedSolution> VRPToursParameter { 48 get { return (ILookupParameter<IVRPEncodedSolution>)Parameters["VRPTours"]; } 49 49 } 50 50 … … 75 75 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The amount of evaluated solutions (here a move is counted only as 4/n evaluated solutions with n being the length of the permutation).")); 76 76 Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection where to store results.")); 77 Parameters.Add(new LookupParameter<IVRPEncod ing>("VRPTours", "The VRP tours to be manipulated."));77 Parameters.Add(new LookupParameter<IVRPEncodedSolution>("VRPTours", "The VRP tours to be manipulated.")); 78 78 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value of the assignment.")); 79 79 Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1))); … … 86 86 } 87 87 88 public static void Apply(AlbaEncod ingsolution, int maxIterations,88 public static void Apply(AlbaEncodedSolution solution, int maxIterations, 89 89 int lambda, int samples, IRandom random, IVRPProblemInstance problemInstance, ref double quality, out int evaluatedSolutions) { 90 90 evaluatedSolutions = 0; … … 93 93 AlbaLambdaInterchangeMove bestMove = null; 94 94 foreach (AlbaLambdaInterchangeMove move in AlbaStochasticLambdaInterchangeMultiMoveGenerator.GenerateAllMoves(solution, problemInstance, lambda, samples, random)) { 95 AlbaEncod ing newSolution = solution.Clone() as AlbaEncoding;95 AlbaEncodedSolution newSolution = solution.Clone() as AlbaEncodedSolution; 96 96 AlbaLambdaInterchangeMoveMaker.Apply(newSolution, move); 97 97 double moveQuality = … … 111 111 public override IOperation InstrumentedApply() { 112 112 int maxIterations = MaximumIterationsParameter.ActualValue.Value; 113 AlbaEncod ingsolution = null;113 AlbaEncodedSolution solution = null; 114 114 115 if (VRPToursParameter.ActualValue is AlbaEncod ing)116 solution = VRPToursParameter.ActualValue as AlbaEncod ing;115 if (VRPToursParameter.ActualValue is AlbaEncodedSolution) 116 solution = VRPToursParameter.ActualValue as AlbaEncodedSolution; 117 117 else 118 VRPToursParameter.ActualValue = solution = AlbaEncod ing.ConvertFrom(VRPToursParameter.ActualValue, ProblemInstance);118 VRPToursParameter.ActualValue = solution = AlbaEncodedSolution.ConvertFrom(VRPToursParameter.ActualValue, ProblemInstance); 119 119 120 120 int lambda = LambdaParameter.Value.Value;
Note: See TracChangeset
for help on using the changeset viewer.