- Timestamp:
- 07/27/12 15:21:20 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearch.cs
r8332 r8346 316 316 #region Helpers 317 317 private void Initialize() { 318 if (Problem != null) {318 if (Problem != null) 319 319 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 320 }321 ParameterizeMainLoop();322 320 } 323 321 private void UpdateAnalyzers() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinCrossover.cs
r8053 r8346 63 63 } 64 64 65 protected Tour FindRoute(PotvinEncoding solution, int city) {65 protected static Tour FindRoute(PotvinEncoding solution, int city) { 66 66 Tour found = null; 67 67 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinRouteBasedCrossover.cs
r8053 r8346 24 24 using HeuristicLab.Encodings.PermutationEncoding; 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Interfaces; 26 27 27 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 43 44 } 44 45 45 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 46 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 47 46 public static PotvinEncoding Apply(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2, IVRPProblemInstance problemInstance, bool allowInfeasible) { 48 47 PotvinEncoding child = parent2.Clone() as PotvinEncoding; 49 48 … … 75 74 child.Unrouted.Add(city); 76 75 77 if (Repair(random, child, replacing, ProblemInstance, allowInfeasible) || allowInfeasible)76 if (Repair(random, child, replacing, problemInstance, allowInfeasible) || allowInfeasible) 78 77 return child; 79 78 else { … … 87 86 } 88 87 } 88 89 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 90 return Apply(random, parent1, parent2, ProblemInstance, AllowInfeasibleSolutions.Value.Value); 91 } 89 92 } 90 93 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs
r8053 r8346 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Problems.VehicleRouting.Interfaces; 25 26 26 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 42 43 } 43 44 44 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 45 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 46 45 public static PotvinEncoding Apply(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2, IVRPProblemInstance problemInstance, bool allowInfeasible) { 47 46 PotvinEncoding child = parent1.Clone() as PotvinEncoding; 48 47 Tour newTour = new Tour(); 49 48 50 int cities = ProblemInstance.Cities.Value;49 int cities = problemInstance.Cities.Value; 51 50 52 51 if (cities > 0) { … … 77 76 child.Unrouted.Add(city); 78 77 79 if (Repair(random, child, newTour, ProblemInstance, allowInfeasible) || allowInfeasible) {78 if (Repair(random, child, newTour, problemInstance, allowInfeasible) || allowInfeasible) { 80 79 return child; 81 80 } else { … … 89 88 } 90 89 } 90 91 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 92 return Apply(random, parent1, parent2, ProblemInstance, AllowInfeasibleSolutions.Value.Value); 93 } 91 94 } 92 95 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj
r7923 r8346 139 139 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMultiMoveGenerator.cs" /> 140 140 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarSingleMoveGenerator.cs" /> 141 <Compile Include="Improver\VRPImprovementOperator.cs" /> 141 142 <Compile Include="Interfaces\IVRPLocalSearchManipulator.cs" /> 142 143 <Compile Include="Interpreters\MDCVRPTWInterpreter.cs" /> … … 145 146 <Compile Include="Interpreters\CVRPInterpreter.cs" /> 146 147 <Compile Include="Interpreters\IVRPDataInterpreter.cs" /> 148 <Compile Include="PathRelinkers\VRPPathRelinker.cs" /> 147 149 <Compile Include="Properties\AssemblyInfo.cs" /> 148 150 <Compile Include="Encodings\Alba\AlbaEncoding.cs" /> … … 336 338 <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPPDTW\CVRPPDTWEvaluator.cs" /> 337 339 <Compile Include="ProblemInstances\SingleDepotVRP\SingleDepotVRPEvaluator.cs" /> 340 <Compile Include="SimilarityCalculators\VRPSimilarityCalculator.cs" /> 338 341 <Compile Include="SolutionParser.cs" /> 339 342 <Compile Include="Variants\Capacitated\Heterogenous\IHeterogenousCapacitatedProblemInstance.cs" /> -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs
r8121 r8346 178 178 179 179 private void AttachProblemInstanceEventHandlers() { 180 var solutionCreatorParameter = SolutionCreatorParameter as ConstrainedValueParameter<IVRPCreator>;181 solutionCreatorParameter.ValidValues.Clear();182 183 180 if (ProblemInstance != null) { 184 181 EvaluatorParameter.Value = ProblemInstance.SolutionEvaluator; 185 IVRPCreator defaultCreator = null;186 foreach (IVRPCreator creator in Operators.Where(o => o is IVRPCreator)) {187 solutionCreatorParameter.ValidValues.Add(creator);188 if (creator is Encodings.Alba.RandomCreator)189 defaultCreator = creator;190 }191 if (defaultCreator != null)192 solutionCreatorParameter.Value = defaultCreator;193 194 182 ProblemInstance.EvaluationChanged += new EventHandler(ProblemInstance_EvaluationChanged); 195 183 } … … 246 234 247 235 private void InitializeOperators() { 236 var solutionCreatorParameter = SolutionCreatorParameter as ConstrainedValueParameter<IVRPCreator>; 237 solutionCreatorParameter.ValidValues.Clear(); 238 248 239 Operators.Clear(); 249 240 … … 252 243 ProblemInstance.Operators.Concat( 253 244 ApplicationManager.Manager.GetInstances<IGeneralVRPOperator>().Cast<IOperator>()).OrderBy(op => op.Name)); 245 Operators.Add(new VRPSimilarityCalculator()); 246 247 IVRPCreator defaultCreator = null; 248 foreach (IVRPCreator creator in Operators.Where(o => o is IVRPCreator)) { 249 solutionCreatorParameter.ValidValues.Add(creator); 250 if (creator is Encodings.Alba.RandomCreator) 251 defaultCreator = creator; 252 } 253 if (defaultCreator != null) 254 solutionCreatorParameter.Value = defaultCreator; 254 255 } 255 256 … … 263 264 } 264 265 } 265 } 266 if (ProblemInstance != null) { 267 foreach (ISingleObjectiveImprovementOperator op in Operators.OfType<ISingleObjectiveImprovementOperator>()) { 268 op.SolutionParameter.ActualName = SolutionCreator.VRPToursParameter.ActualName; 269 op.SolutionParameter.Hidden = true; 270 } 271 foreach (ISingleObjectivePathRelinker op in Operators.OfType<ISingleObjectivePathRelinker>()) { 272 op.ParentsParameter.ActualName = SolutionCreator.VRPToursParameter.ActualName; 273 op.ParentsParameter.Hidden = true; 274 } 275 foreach (VRPSimilarityCalculator op in Operators.OfType<VRPSimilarityCalculator>()) { 276 op.SolutionVariableName = SolutionCreator.VRPToursParameter.ActualName; 277 op.QualityVariableName = ProblemInstance.SolutionEvaluator.QualityParameter.ActualName; 278 op.ProblemInstance = ProblemInstance; 279 } 280 } 281 } 282 266 283 #endregion 267 284
Note: See TracChangeset
for help on using the changeset viewer.