Changeset 12070 for trunk/sources
- Timestamp:
- 02/25/15 10:59:20 (10 years ago)
- Location:
- trunk/sources
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Operators/3.3/NoSimilarityCalculator.cs
r12012 r12070 32 32 [Item("NoSimilarityCalculator", "An item that performs similarity calculation between two solutions. The item always considers two solutions to be distinct.")] 33 33 public sealed class NoSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 34 protected override bool IsCommutative { get { return true; } } 35 34 36 private NoSimilarityCalculator(bool deserializing) : base(deserializing) { } 35 37 private NoSimilarityCalculator(NoSimilarityCalculator original, Cloner cloner) : base(original, cloner) { } -
trunk/sources/HeuristicLab.Optimization.Operators/3.3/QualitySimilarityCalculator.cs
r12012 r12070 34 34 [Item("QualitySimilarityCalculator", "An item that performs similarity calculation between two solutions. The item only considers the qualities of the two solutions.")] 35 35 public sealed class QualitySimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 36 protected override bool IsCommutative { get { return true; } } 37 36 38 private QualitySimilarityCalculator(bool deserializing) : base(deserializing) { } 37 39 private QualitySimilarityCalculator(QualitySimilarityCalculator original, Cloner cloner) : base(original, cloner) { } -
trunk/sources/HeuristicLab.Optimization.Operators/3.3/SolutionSimilarityCalculator.cs
r12012 r12070 33 33 [StorableClass] 34 34 public abstract class SolutionSimilarityCalculator : Item, ISolutionSimilarityCalculator { 35 protected abstract bool IsCommutative { get; } 36 35 37 [StorableConstructor] 36 38 protected SolutionSimilarityCalculator(bool deserializing) : base(deserializing) { } … … 71 73 for (int i = 0; i < individuals.Count; i++) similarityMatrix[i] = new double[individuals.Count]; 72 74 73 for (int i = 0; i < individuals.Count; i++) { 74 for (int j = i; j < individuals.Count; j++) { 75 similarityMatrix[i][j] = similarityMatrix[j][i] = CalculateSolutionSimilarity(individuals[i], individuals[j]); 75 if (IsCommutative) { 76 for (int i = 0; i < individuals.Count; i++) { 77 for (int j = i; j < individuals.Count; j++) { 78 similarityMatrix[i][j] = similarityMatrix[j][i] = CalculateSolutionSimilarity(individuals[i], individuals[j]); 79 } 80 } 81 } else { 82 for (int i = 0; i < individuals.Count; i++) { 83 for (int j = i; j < individuals.Count; j++) { 84 similarityMatrix[i][j] = CalculateSolutionSimilarity(individuals[i], individuals[j]); 85 if (i == j) continue; 86 similarityMatrix[j][i] = CalculateSolutionSimilarity(individuals[j], individuals[i]); 87 } 76 88 } 77 89 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
r11978 r12070 36 36 public class SymbolicExpressionTreeBottomUpSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 37 37 private readonly HashSet<string> commutativeSymbols = new HashSet<string> { "Addition", "Multiplication", "Average", "And", "Or", "Xor" }; 38 39 protected override bool IsCommutative { get { return true; } } 40 38 41 public SymbolicExpressionTreeBottomUpSimilarityCalculator() { } 39 42 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator.cs
r12012 r12070 31 31 [Item("SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator", "A similarity calculator based on the size of the maximum common subtree between two trees")] 32 32 public class SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 33 protected override bool IsCommutative { get { return true; } } 34 33 35 [Storable] 34 36 private readonly SymbolicExpressionTreeNodeEqualityComparer comparer; -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/SimilarityCalculators/KnapsackSimilarityCalculator.cs
r12012 r12070 35 35 [Item("KnapsackSimilarityCalculator", "An operator that performs similarity calculation between two knapsack solutions. The operator calculates the similarity based on the number of elements the two solutions have in common.")] 36 36 public sealed class KnapsackSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 37 protected override bool IsCommutative { get { return true; } } 38 37 39 private KnapsackSimilarityCalculator(bool deserializing) : base(deserializing) { } 38 40 private KnapsackSimilarityCalculator(KnapsackSimilarityCalculator original, Cloner cloner) : base(original, cloner) { } -
trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/QAPSimilarityCalculator.cs
r12012 r12070 35 35 [Item("QAPSimilarityCalculator", "An operator that performs similarity calculation between two quadratic assignment solutions. The operator calculates the similarity based on the number of edges the two solutions have in common.")] 36 36 public sealed class QAPSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 37 protected override bool IsCommutative { get { return true; } } 38 37 39 private QAPSimilarityCalculator(bool deserializing) : base(deserializing) { } 38 40 private QAPSimilarityCalculator(QAPSimilarityCalculator original, Cloner cloner) : base(original, cloner) { } -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SimilarityCalculators/SingleObjectiveTestFunctionSimilarityCalculator.cs
r12012 r12070 38 38 [StorableClass] 39 39 public sealed class SingleObjectiveTestFunctionSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 40 #region Properties 40 protected override bool IsCommutative { get { return true; } } 41 41 42 [Storable] 42 43 public DoubleMatrix Bounds { get; set; } 43 #endregion44 44 45 45 [StorableConstructor] -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/SimilarityCalculators/TSPSimilarityCalculator.cs
r12012 r12070 35 35 [Item("TSPSimilarityCalculator", "An operator that performs similarity calculation between two traveling salesman solutions. The operator calculates the similarity based on the number of edges the two solutions have in common.")] 36 36 public sealed class TSPSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 37 protected override bool IsCommutative { get { return true; } } 38 37 39 private TSPSimilarityCalculator(bool deserializing) : base(deserializing) { } 38 40 private TSPSimilarityCalculator(TSPSimilarityCalculator original, Cloner cloner) : base(original, cloner) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/SimilarityCalculators/VRPSimilarityCalculator.cs
r12012 r12070 40 40 [StorableClass] 41 41 public sealed class VRPSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 42 #region Properties 42 protected override bool IsCommutative { get { return true; } } 43 43 44 [Storable] 44 45 public IVRPProblemInstance ProblemInstance { get; set; } 45 #endregion46 46 47 47 private VRPSimilarityCalculator(bool deserializing) : base(deserializing) { }
Note: See TracChangeset
for help on using the changeset viewer.