- Timestamp:
- 12/05/16 12:27:19 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MemPRAlgorithm/HeuristicLab.Problems.QuadraticAssignment/3.3/QAPBasicProblem.cs
r14451 r14453 20 20 #endregion 21 21 22 using System.Linq; 23 using HeuristicLab.Analysis; 22 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Core; … … 25 27 using HeuristicLab.Encodings.PermutationEncoding; 26 28 using HeuristicLab.Optimization; 29 using HeuristicLab.Optimization.Operators; 27 30 using HeuristicLab.Parameters; 28 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 30 33 31 34 namespace HeuristicLab.Problems.QuadraticAssignment { 32 [Item("Basic Quadratic Assignment Problem ( BQAP)", "The Quadratic Assignment Problem (QAP) can be described as the problem of assigning N facilities to N fixed locations such that there is exactly one facility in each location and that the sum of the distances multiplied by the connection strength between the facilities becomes minimal.")]35 [Item("Basic Quadratic Assignment Problem (QAP)", "The Quadratic Assignment Problem (QAP) can be described as the problem of assigning N facilities to N fixed locations such that there is exactly one facility in each location and that the sum of the distances multiplied by the connection strength between the facilities becomes minimal.")] 33 36 [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 141)] 34 37 [StorableClass] … … 62 65 Parameters.Add(weightsParameter = new ValueParameter<DoubleMatrix>("Weights", "The weights matrix.", new DoubleMatrix(5, 5))); 63 66 Parameters.Add(distancesParameter = new ValueParameter<DoubleMatrix>("Distances", "The distances matrix.", new DoubleMatrix(5, 5))); 67 68 Operators.Add(new HammingSimilarityCalculator()); 69 Operators.Add(new QualitySimilarityCalculator()); 70 Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>())); 71 72 Parameterize(); 64 73 } 65 74 66 75 public override IDeepCloneable Clone(Cloner cloner) { 67 76 return new QAPBasicProblem(this, cloner); 77 } 78 79 protected override void OnEncodingChanged() { 80 base.OnEncodingChanged(); 81 Parameterize(); 82 } 83 84 private void Parameterize() { 85 foreach (var similarityCalculator in Operators.OfType<ISolutionSimilarityCalculator>()) { 86 similarityCalculator.SolutionVariableName = Encoding.SolutionCreator.PermutationParameter.ActualName; 87 similarityCalculator.QualityVariableName = Evaluator.QualityParameter.ActualName; 88 } 68 89 } 69 90 … … 116 137 Weights = weights; 117 138 Distances = distances; 139 Encoding.Length = Weights.Rows; 118 140 119 141 BestKnownQuality = double.NaN;
Note: See TracChangeset
for help on using the changeset viewer.