- Timestamp:
- 02/03/12 10:01:37 (13 years ago)
- Location:
- branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs
r7438 r7443 31 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.Instances; 33 34 34 35 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { … … 82 83 get { return (FixedValueParameter<DoubleValue>)Parameters["OverbookedCapacityPenalty"]; } 83 84 } 84 public OptionalValueParameter< IItem> BestKnownSolutionParameter {85 get { return (OptionalValueParameter< IItem>)Parameters["BestKnownSolution"]; }85 public OptionalValueParameter<GQAPSolution> BestKnownSolutionParameter { 86 get { return (OptionalValueParameter<GQAPSolution>)Parameters["BestKnownSolution"]; } 86 87 } 87 88 public OptionalValueParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter { … … 117 118 set { CapacitiesParameter.Value = value; } 118 119 } 119 public double TransportationCosts {120 get { return TransportationCostsParameter.Value .Value; }121 set { TransportationCostsParameter.Value .Value= value; }122 } 123 public double OverbookedCapacityPenalty {124 get { return TransportationCostsParameter.Value .Value; }125 set { TransportationCostsParameter.Value .Value= value; }120 public DoubleValue TransportationCosts { 121 get { return TransportationCostsParameter.Value; } 122 set { TransportationCostsParameter.Value = value; } 123 } 124 public DoubleValue OverbookedCapacityPenalty { 125 get { return TransportationCostsParameter.Value; } 126 set { TransportationCostsParameter.Value = value; } 126 127 } 127 128 public StringArray EquipmentNames { … … 132 133 get { return LocationNamesParameter.Value; } 133 134 set { LocationNamesParameter.Value = value; } 135 } 136 public GQAPSolution BestKnownSolution { 137 get { return BestKnownSolutionParameter.Value; } 138 set { BestKnownSolutionParameter.Value = value; } 134 139 } 135 140 #endregion … … 157 162 Parameters.Add(new ValueParameter<DoubleArray>("Demands", DemandsDescription, new DoubleArray(), false)); 158 163 Parameters.Add(new ValueParameter<DoubleArray>("Capacities", CapacitiesDescription, new DoubleArray(), false)); 159 Parameters.Add(new OptionalValueParameter< IItem>("BestKnownSolution", BestKnownSolutionDescription, null, false));164 Parameters.Add(new OptionalValueParameter<GQAPSolution>("BestKnownSolution", BestKnownSolutionDescription, null, false)); 160 165 Parameters.Add(new OptionalValueParameter<GQAPAssignmentArchive>("BestKnownSolutions", BestKnownSolutionsDescription, null, false)); 161 166 Parameters.Add(new OptionalValueParameter<StringArray>("EquipmentNames", EquipmentNamesDescription, null, false)); 162 167 Parameters.Add(new OptionalValueParameter<StringArray>("LocationNames", LocationNamesDescription, null, false)); 163 164 BestKnownQualityParameter.Value = null;165 168 166 169 WeightsParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false; … … 182 185 InstallationCosts = new DoubleMatrix(5, 3); 183 186 184 TransportationCosts = 1;185 186 187 Demands = new DoubleArray(5); 187 188 Demands[0] = 2; Demands[1] = 1; Demands[2] = 3; Demands[3] = 1; Demands[4] = 1; … … 198 199 public override IDeepCloneable Clone(Cloner cloner) { 199 200 return new GeneralizedQuadraticAssignmentProblem(this, cloner); 201 } 202 203 public void LoadFrom(IQAPInstance format) { 204 Weights = new DoubleMatrix(format.Weights); 205 Distances = new DoubleMatrix(format.Distances); 206 InstallationCosts = new DoubleMatrix(Weights.Rows, Distances.Columns); 207 Capacities = new DoubleArray(Enumerable.Range(0, Distances.Rows).Select(x => 1.0).ToArray()); 208 Demands = new DoubleArray(Enumerable.Range(0, Weights.Rows).Select(x => 1.0).ToArray()); 209 210 if (format.BestKnownAssignment != null) { 211 var assignment = new IntegerVector(format.BestKnownAssignment); 212 double flowDistanceQuality, installationQuality, overbookedCapacity; 213 GQAPEvaluator.Evaluate(assignment, Weights, Distances, InstallationCosts, Demands, Capacities, 214 out flowDistanceQuality, out installationQuality, out overbookedCapacity); 215 double quality = GQAPEvaluator.GetCombinedQuality(flowDistanceQuality, installationQuality, overbookedCapacity, TransportationCosts.Value, OverbookedCapacityPenalty.Value); 216 BestKnownSolution = new GQAPSolution(assignment, new DoubleValue(quality), new DoubleValue(flowDistanceQuality), new DoubleValue(installationQuality), new DoubleValue(overbookedCapacity)); 217 BestKnownQuality = new DoubleValue(quality); 218 } 200 219 } 201 220 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj
r7438 r7443 166 166 <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3</Name> 167 167 </ProjectReference> 168 <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj"> 169 <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project> 170 <Name>HeuristicLab.Problems.Instances-3.3</Name> 171 </ProjectReference> 168 172 </ItemGroup> 169 173 <ItemGroup /> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Interfaces/IBestKnownSolutionAwareGQAPOperator.cs
r7419 r7443 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.IntegerVectorEncoding;24 23 25 24 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 26 25 public interface IBestKnownSolutionAwareGQAPOperator : IGQAPOperator { 27 ILookupParameter< IntegerVector> BestKnownSolutionParameter { get; }26 ILookupParameter<GQAPSolution> BestKnownSolutionParameter { get; } 28 27 } 29 28 }
Note: See TracChangeset
for help on using the changeset viewer.