Changeset 11202 for branches/HiveStatistics/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers
- Timestamp:
- 07/18/14 12:01:13 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Problems.VehicleRouting
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/BiasedMultiVRPSolutionCrossover.cs
r6851 r11202 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 1Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 using System.Text; 24 using HeuristicLab.Analysis; 25 using HeuristicLab.Collections; 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 28 using HeuristicLab.Data; 29 using HeuristicLab.Optimization; 30 using HeuristicLab.Parameters; 27 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Common; 29 using HeuristicLab.Analysis; 30 using HeuristicLab.Parameters; 31 using HeuristicLab.Optimization; 32 using HeuristicLab.Data; 33 using HeuristicLab.Collections; 32 using HeuristicLab.Random; 34 33 35 34 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { … … 69 68 Parameters.Add(new ValueParameter<DoubleValue>("LowerBound", "The depth of the individuals in the scope tree.", new DoubleValue(0.01))); 70 69 Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1))); 70 71 SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator"; 71 72 } 72 73 … … 81 82 } 82 83 83 public override IOperation Apply() {84 public override IOperation InstrumentedApply() { 84 85 IOperator successor = null; 85 86 … … 133 134 } 134 135 135 //////////////// 136 //////////////// code has to be duplicated since ActualProbabilitiesParameter.ActualValue are updated and used for operator selection 136 137 IRandom random = RandomParameter.ActualValue; 137 138 DoubleArray probabilities = ActualProbabilitiesParameter.ActualValue; … … 142 143 if (checkedOperators.Count() > 0) { 143 144 // select a random operator from the checked operators 144 double sum = (from indexedItem in checkedOperators select probabilities[indexedItem.Index]).Sum(); 145 if (sum == 0) throw new InvalidOperationException(Name + ": All selected operators have zero probability."); 146 double r = random.NextDouble() * sum; 147 sum = 0; 148 foreach (var indexedItem in checkedOperators) { 149 sum += probabilities[indexedItem.Index]; 150 if (sum > r) { 151 successor = indexedItem.Value; 152 break; 153 } 154 } 145 successor = checkedOperators.SampleProportional(random, 1, checkedOperators.Select(x => probabilities[x.Index]), false, false).First().Value; 155 146 } 156 147 -
branches/HiveStatistics/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/MultiVRPSolutionCrossover.cs
r8053 r11202 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 67 67 Parameters.Add(new LookupParameter<IVRPEncoding>("Child", "The child permutation resulting from the crossover.")); 68 68 ChildParameter.ActualName = "VRPTours"; 69 70 SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator"; 69 71 } 70 72 … … 106 108 } 107 109 108 public override IOperation Apply() {110 public override IOperation InstrumentedApply() { 109 111 if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one permutation crossover to choose from."); 110 return base. Apply();112 return base.InstrumentedApply(); 111 113 } 112 114 } -
branches/HiveStatistics/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/RandomParentCloneCrossover.cs
r8053 r11202 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 65 65 } 66 66 67 public override IOperation Apply() {67 public override IOperation InstrumentedApply() { 68 68 if (RandomParameter.ActualValue.Next() < 0.5) 69 69 ChildParameter.ActualValue = ParentsParameter.ActualValue[0].Clone() as IVRPEncoding; … … 71 71 ChildParameter.ActualValue = ParentsParameter.ActualValue[1].Clone() as IVRPEncoding; 72 72 73 return base. Apply();73 return base.InstrumentedApply(); 74 74 } 75 75 } -
branches/HiveStatistics/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/VRPCrossover.cs
r8053 r11202 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.