Changeset 17712 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin
- Timestamp:
- 08/04/20 07:06:39 (4 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PushForwardInsertionCreator.cs
r17698 r17712 22 22 using System; 23 23 using System.Collections.Generic; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; … … 27 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Parameters; 29 using HEAL.Attic;30 30 using HeuristicLab.Problems.VehicleRouting.Interfaces; 31 31 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; … … 299 299 } else { 300 300 double cost = tourCost; 301 bool feasible = problemInstance.Feasible(eval); 302 if (cost < minimumCost && feasible) { 301 if (cost < minimumCost && eval.IsFeasible) { 303 302 customer = unrouted; 304 303 minimumCost = cost; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinCrossover.cs
r17698 r17712 21 21 22 22 using System.Collections.Generic; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 26 27 using HeuristicLab.Optimization; 27 28 using HeuristicLab.Parameters; 28 using HEAL.Attic;29 29 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 30 30 using HeuristicLab.Problems.VehicleRouting.Interfaces; … … 134 134 solution.Tours.Remove(tour); 135 135 } 136 137 if (newTour.Stops.Count > 0 && !allowInfeasible && ! instance.TourFeasible(newTour, solution))136 var tourEval = instance.EvaluateTour(newTour, solution); 137 if (newTour.Stops.Count > 0 && !allowInfeasible && !tourEval.IsFeasible) 138 138 return false; 139 139 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs
r17698 r17712 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using HEAL.Attic; 22 25 using HeuristicLab.Common; 23 26 using HeuristicLab.Core; 24 using HEAL.Attic;25 using System.Collections.Generic;26 27 using HeuristicLab.Data; 27 using System;28 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Problems.VehicleRouting.Interfaces; 29 30 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; 30 using HeuristicLab.Problems.VehicleRouting.Interfaces;31 31 32 32 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 165 165 double minDetour = 0; 166 166 VRPEvaluation eval = ProblemInstance.EvaluateTour(tour, individual); 167 bool originalFeasible = ProblemInstance.Feasible(eval);168 167 169 168 for (int i = 0; i <= tour.Stops.Count; i++) { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinLocalSearchManipulator.cs
r17698 r17712 21 21 22 22 using System.Collections.Generic; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; 26 27 using HeuristicLab.Parameters; 27 using HEAL.Attic;28 28 using HeuristicLab.Problems.VehicleRouting.Interfaces; 29 29 … … 70 70 distance = individual.GetTourLength(individual.Tours[currentTour]); 71 71 individual.Tours[currentTour].Stops.InsertRange(currentCity, toBeDeleted); 72 if (instance.TourFeasible(individual.Tours[currentTour], individual)) { 72 var tourEval = instance.EvaluateTour(individual.Tours[currentTour], individual); 73 if (tourEval.IsFeasible) { 73 74 double lengthIncrease = 74 75 individual.GetTourLength(individual.Tours[currentTour]) - distance; … … 94 95 public static void ApplyManipulation(IRandom random, PotvinEncodedSolution individual, IVRPProblemInstance instance, int maxIterations) { 95 96 //only apply to feasible individuals 96 if (instance.Feasible(individual)) { 97 var eval = instance.Evaluate(individual); 98 if (eval.IsFeasible) { 97 99 bool insertionFound; 98 100 int iterations = 0; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinPairwiseOneLevelExchangeManipulator.cs
r17698 r17712 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using H EAL.Attic;25 using HeuristicLab.Problems.VehicleRouting.Interfaces; 25 26 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; 26 27 using HeuristicLab.Problems.VehicleRouting.Variants; 27 using HeuristicLab.Problems.VehicleRouting.Interfaces;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 88 88 89 89 if (delta < bestQuality && 90 ( instance.Feasible(evalNew)|| allowInfeasible)) {90 (evalNew.IsFeasible || allowInfeasible)) { 91 91 bestQuality = delta; 92 92 bestTour = tourIdx; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinPairwiseTwoLevelExchangeManipulator.cs
r17698 r17712 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Encodings.PermutationEncoding; 25 using H EAL.Attic;26 using HeuristicLab.Problems.VehicleRouting.Interfaces; 26 27 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; 27 28 using HeuristicLab.Problems.VehicleRouting.Variants; 28 using HeuristicLab.Problems.VehicleRouting.Interfaces;29 29 30 30 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 77 77 78 78 replacedSourceTour.Stops[replacedSourceTour.Stops.IndexOf(replacedSource)] = replacingSource; 79 if (!allowInfeasible && !instance.TourFeasible(replacedSourceTour, individual)) 79 var evalSourceTour = instance.EvaluateTour(replacedSourceTour, individual); 80 if (!allowInfeasible && !evalSourceTour.IsFeasible) 80 81 return null; 81 82 83 var evalTargetTour = instance.EvaluateTour(replacedTargetTour, individual); 82 84 replacedTargetTour.Stops[replacedTargetTour.Stops.IndexOf(replacedTarget)] = replacingTarget; 83 if (!allowInfeasible && ! instance.TourFeasible(replacedTargetTour, individual))85 if (!allowInfeasible && !evalTargetTour.IsFeasible) 84 86 return null; 85 87 … … 101 103 102 104 if (delta < bestQuality && 103 ( instance.Feasible(evalNew)|| allowInfeasible)) {105 (evalNew.IsFeasible || allowInfeasible)) { 104 106 bestQuality = delta; 105 107 bestTour = tourIdx; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinTwoLevelExchangeManipulator.cs
r17698 r17712 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using HEAL.Attic;25 25 using HeuristicLab.Problems.VehicleRouting.Interfaces; 26 26 … … 62 62 route1.Stops.RemoveAt(customer1Position); 63 63 64 if (instance.TourFeasible(tour, individual)) { 64 var tourEval = instance.EvaluateTour(tour, individual); 65 if (tourEval.IsFeasible) { 65 66 int routeIdx, place; 66 67 if (FindInsertionPlace(individual, -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncodedSolution.cs
r17698 r17712 219 219 220 220 VRPEvaluation eval = ProblemInstance.Evaluate(this); 221 bool originalFeasible = ProblemInstance.Feasible(eval);222 221 223 222 for (int tour = 0; tour < Tours.Count; tour++) {
Note: See TracChangeset
for help on using the changeset viewer.