Changeset 7438 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers
- Timestamp:
- 02/01/12 13:28:54 (13 years ago)
- Location:
- branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers/BestGQAPSolutionAnalyzer.cs
r7437 r7438 41 41 IDemandsAwareGQAPOperator, ICapacitiesAwareGQAPOperator, ITransportationCostsAwareGQAPOperator, 42 42 IOverbookedCapacityPenaltyAwareGQAPOperator, IEquipmentNamesAwareGQAPOperator, ILocationNamesAwareGQAPOperator, 43 IBestKnownQualityAwareGQAPOperator, IBestKnownSolutionAwareGQAPOperator, IAnalyzer { 43 IBestKnownQualityAwareGQAPOperator, IBestKnownSolutionAwareGQAPOperator, IBestKnownSolutionsAwareGQAPOperator, 44 IAnalyzer { 44 45 45 46 public bool EnabledByDefault { … … 47 48 } 48 49 50 #region Parameter Properties 49 51 public IScopeTreeLookupParameter<IntegerVector> AssignmentParameter { 50 52 get { return (IScopeTreeLookupParameter<IntegerVector>)Parameters["Assignment"]; } … … 98 100 get { return (ILookupParameter<IntegerVector>)Parameters["BestKnownSolution"]; } 99 101 } 102 public ILookupParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter { 103 get { return (ILookupParameter<GQAPAssignmentArchive>)Parameters["BestKnownSolutions"]; } 104 } 100 105 public ILookupParameter<GQAPAssignment> BestSolutionParameter { 101 106 get { return (ILookupParameter<GQAPAssignment>)Parameters["BestSolution"]; } … … 104 109 get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; } 105 110 } 111 #endregion 106 112 107 113 [StorableConstructor] … … 130 136 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", GeneralizedQuadraticAssignmentProblem.BestKnownQualityDescription)); 131 137 Parameters.Add(new LookupParameter<IntegerVector>("BestKnownSolution", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionDescription)); 138 Parameters.Add(new LookupParameter<GQAPAssignmentArchive>("BestKnownSolutions", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionsDescription)); 132 139 Parameters.Add(new LookupParameter<GQAPAssignment>("BestSolution", "The best GQAP solution found so far.")); 133 140 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best GQAP solution should be stored.")); … … 152 159 var maximization = MaximizationParameter.ActualValue.Value; 153 160 var bestKnownQuality = BestKnownQualityParameter.ActualValue; 161 var bestKnownSolutions = BestKnownSolutionsParameter.ActualValue; 154 162 155 163 int bestIndex; … … 186 194 } 187 195 196 GQAPAssignmentArchive archive = BestKnownSolutionsParameter.ActualValue; 197 if (archive == null) { 198 archive = new GQAPAssignmentArchive(equipmentNames, locationNames, distances, weights, installationCosts, demands, capacities, transportationCosts, overbookedCapacityPenalty); 199 BestKnownSolutionsParameter.ActualValue = archive; 200 } else { 201 var solutions = Enumerable.Range(0, assignments.Length) 202 .Select(i => new GQAPSolution(assignments[i], qualities[i], flowDistanceQualities[i], installationQualities[i], overbookedCapacities[i])) 203 .Concat(archive.Solutions); 204 archive.Solutions = GQAPSolutionArchiveUpdater.GetFeasibleParetoFront(solutions); 205 } 206 188 207 return base.Apply(); 189 208 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers/GQAPPopulationDiversityAnalyzer.cs
r7437 r7438 38 38 } 39 39 public new ILookupParameter<BoolValue> MaximizationParameter { 40 get { return MaximizationParameter; }40 get { return base.MaximizationParameter; } 41 41 } 42 42 public new IScopeTreeLookupParameter<DoubleValue> QualityParameter { 43 get { return QualityParameter; }43 get { return base.QualityParameter; } 44 44 } 45 45 public IScopeTreeLookupParameter<DoubleValue> FlowDistanceQualityParameter { -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers/GQAPSolutionArchiveAnalyzer.cs
r7437 r7438 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 163 164 } 164 165 165 ItemList<GQAPSolution> front = new ItemList<GQAPSolution>(archive.Solutions); 166 for (int i = 0; i < assignments.Length; i++) { 167 if (overbookedCapacities[i].Value <= 0.0) 168 front.Add(new GQAPSolution(assignments[i], qualities[i], flowDistanceQualities[i], installationQualities[i], overbookedCapacities[i])); 169 } 170 171 for (int i = 0; i < front.Count - 1; i++) { 172 for (int j = i + 1; j < front.Count; j++) { 173 if (front[i].FlowDistanceQuality.Value < front[j].FlowDistanceQuality.Value 174 && front[i].InstallationQuality.Value < front[j].InstallationQuality.Value) { 175 front.RemoveAt(j); 176 j--; 177 } else if (front[i].FlowDistanceQuality.Value > front[j].FlowDistanceQuality.Value 178 && front[i].InstallationQuality.Value > front[j].InstallationQuality.Value) { 179 front.RemoveAt(i); 180 j = i; 181 } 182 } 183 } 184 185 archive.Solutions = front; 166 var solutions = Enumerable.Range(0, assignments.Length) 167 .Select(i => new GQAPSolution(assignments[i], qualities[i], flowDistanceQualities[i], installationQualities[i], overbookedCapacities[i])) 168 .Concat(archive.Solutions); 169 archive.Solutions = GQAPSolutionArchiveUpdater.GetFeasibleParetoFront(solutions); 186 170 187 171 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.