- Timestamp:
- 04/24/12 14:22:32 (13 years ago)
- Location:
- branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/HeuristicLab.Algorithms.ScatterSearch-3.3.csproj
r7744 r7756 87 87 <ItemGroup> 88 88 <Compile Include="DiversityCalculator.cs" /> 89 <Compile Include="IPathRelinker.cs" /> 89 90 <Compile Include="Knapsack\BinaryVectorDiversityCalculator.cs" /> 91 <Compile Include="Knapsack\KnapsackPathRelinker.cs" /> 92 <Compile Include="TravelingSalesman\TravelingSalesmanPathRelinker.cs" /> 93 <Compile Include="PathRelinker.cs" /> 90 94 <Compile Include="Knapsack\INBinaryVectorCrossover.cs" /> 91 95 <Compile Include="IScatterSearchTargetProcessor.cs" /> -
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/BinaryVectorDiversityCalculator.cs
r7744 r7756 31 31 [Item("BinaryVectorDiversityCalculator", "An operator that performs diversity calculation between bool-valued vectors.")] 32 32 [StorableClass] 33 public sealed class BinaryVectorDiversityCalculator : HeuristicLab.Algorithms.ScatterSearch.DiversityCalculator {33 public sealed class BinaryVectorDiversityCalculator : DiversityCalculator { 34 34 [StorableConstructor] 35 35 private BinaryVectorDiversityCalculator(bool deserializing) : base(deserializing) { } -
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/KnapsackImprovementOperator.cs
r7744 r7756 39 39 [StorableClass] 40 40 public sealed class KnapsackImprovementOperator : SingleSuccessorOperator, ILocalImprovementOperator, IScatterSearchTargetProcessor { 41 42 41 #region Problem properties 43 42 public Type ProblemType { -
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NBinaryVectorCrossover.cs
r7744 r7756 64 64 #region Create parameters 65 65 Parameters.Add(new ScopeParameter("CurrentScope")); 66 Parameters.Add(new LookupParameter<IRandom>("Random" , "The pseudo random number generator which should be used for stochastic crossover operators."));67 Parameters.Add(new ScopeTreeLookupParameter<BinaryVector>("Parents" , "The parent vectors which should be crossed."));66 Parameters.Add(new LookupParameter<IRandom>("Random")); 67 Parameters.Add(new ScopeTreeLookupParameter<BinaryVector>("Parents")); 68 68 #endregion 69 69 ParentsParameter.ActualName = "BinaryVector"; -
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NChildCrossover.cs
r7744 r7756 78 78 79 79 protected override ItemArray<BinaryVector> Cross(IRandom random, ItemArray<BinaryVector> parents) { 80 if (parents.Length != 2) throw new ArgumentException(" ERROR in NChildCrossover: The number of parents is not equal to 2");80 if (parents.Length != 2) throw new ArgumentException("NChildCrossover: The number of parents is not equal to 2."); 81 81 82 82 if (NParameter.ActualValue == null) throw new InvalidOperationException("NChildCrossover: Parameter " + NParameter.ActualName + " could not be found."); -
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearch.cs
r7744 r7756 306 306 ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault(); 307 307 308 CrossoverParameter.ValidValues.Add(new TravelingSalesman.TravelingSalesmanPathRelinker()); 309 CrossoverParameter.ValidValues.Add(new Knapsack.KnapsackPathRelinker()); 310 308 311 foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name)) 309 312 CrossoverParameter.ValidValues.Add(crossover); -
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/TravelingSalesman/PermutationDiversityCalculator.cs
r7744 r7756 32 32 [Item("PermutationDiversityCalculator", "An operator that performs diversity calculation between permutations.")] 33 33 [StorableClass] 34 public sealed class PermutationDiversityCalculator : HeuristicLab.Algorithms.ScatterSearch.DiversityCalculator {34 public sealed class PermutationDiversityCalculator : DiversityCalculator { 35 35 [StorableConstructor] 36 36 private PermutationDiversityCalculator(bool deserializing) : base(deserializing) { } -
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/TravelingSalesman/TravelingSalesmanImprovementOperator.cs
r7744 r7756 39 39 [StorableClass] 40 40 public sealed class TravelingSalesmanImprovementOperator : SingleSuccessorOperator, ILocalImprovementOperator, IScatterSearchTargetProcessor { 41 42 41 #region Problem properties 43 42 public Type ProblemType { … … 62 61 get { return (IValueLookupParameter<IEvaluator>)Parameters["Evaluator"]; } 63 62 } 64 public IValueLookupParameter<IntValue> Improvement IterationsParameter {65 get { return (IValueLookupParameter<IntValue>)Parameters["Improvement Iterations"]; }63 public IValueLookupParameter<IntValue> ImprovementAttemptsParameter { 64 get { return (IValueLookupParameter<IntValue>)Parameters["ImprovementAttempts"]; } 66 65 } 67 66 public IValueLookupParameter<IRandom> RandomParameter { … … 96 95 set { EvaluatorParameter.ActualValue = value; } 97 96 } 98 public IntValue Improvement Iterations {99 get { return Improvement IterationsParameter.ActualValue; }100 set { Improvement IterationsParameter.ActualValue = value; }97 public IntValue ImprovementAttempts { 98 get { return ImprovementAttemptsParameter.ActualValue; } 99 set { ImprovementAttemptsParameter.ActualValue = value; } 101 100 } 102 101 public IRandom Random { … … 118 117 : base() { 119 118 #region Create parameters 120 Parameters.Add(new ScopeParameter("CurrentScope" , "The current scope."));121 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Coordinates" , "The coordinates of the cities."));122 Parameters.Add(new ValueLookupParameter<IEvaluator>("Evaluator" , "The operator which is used to evaluate new solutions."));123 Parameters.Add(new ValueLookupParameter<IntValue>("Improvement Iterations", "The number of improvement attempts."));124 Parameters.Add(new ValueLookupParameter<IRandom>("Random" , "..."));119 Parameters.Add(new ScopeParameter("CurrentScope")); 120 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Coordinates")); 121 Parameters.Add(new ValueLookupParameter<IEvaluator>("Evaluator")); 122 Parameters.Add(new ValueLookupParameter<IntValue>("ImprovementAttempts", new IntValue(100))); 123 Parameters.Add(new ValueLookupParameter<IRandom>("Random")); 125 124 Parameters.Add(new ValueLookupParameter<IItem>("Target")); 126 125 #endregion … … 138 137 double bestLength = currLength; 139 138 140 for (int i = 0; i < Improvement Iterations.Value; i++) {139 for (int i = 0; i < ImprovementAttempts.Value; i++) { 141 140 int a = Random.Next(currSol.Length - 1); 142 141 int b = Random.Next(currSol.Length - 1);
Note: See TracChangeset
for help on using the changeset viewer.