Changeset 7443


Ignore:
Timestamp:
02/03/12 10:01:37 (9 years ago)
Author:
abeham
Message:

#1614

  • worked on generic instance provider
  • added CTAP instances
Location:
branches/GeneralizedQAP
Files:
400 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/GeneralizedQAP.sln

    r7412 r7443  
    1818    TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
    1919  EndProjectSection
     20EndProject
     21Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.QAPLIB-3.3", "HeuristicLab.Problems.Instances.QAPLIB\3.3\HeuristicLab.Problems.Instances.QAPLIB-3.3.csproj", "{73F29D43-5714-4069-8FAB-0D18FEB5F175}"
     22EndProject
     23Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances-3.3", "HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj", "{3540E29E-4793-49E7-8EE2-FEA7F61C3994}"
     24EndProject
     25Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.ElloumiCTAP-3.3", "HeuristicLab.Problems.Instances.ElloumiCTAP\3.3\HeuristicLab.Problems.Instances.ElloumiCTAP-3.3.csproj", "{CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}"
    2026EndProject
    2127Global
     
    7278    {68C6C157-08DA-414F-9256-CCCA13038399}.Release|x64.ActiveCfg = Release|Any CPU
    7379    {68C6C157-08DA-414F-9256-CCCA13038399}.Release|x86.ActiveCfg = Release|Any CPU
     80    {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     81    {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Debug|Any CPU.Build.0 = Debug|Any CPU
     82    {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Debug|x64.ActiveCfg = Debug|Any CPU
     83    {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Debug|x86.ActiveCfg = Debug|Any CPU
     84    {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Release|Any CPU.ActiveCfg = Release|Any CPU
     85    {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Release|Any CPU.Build.0 = Release|Any CPU
     86    {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Release|x64.ActiveCfg = Release|Any CPU
     87    {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Release|x86.ActiveCfg = Release|Any CPU
     88    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     89    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Debug|Any CPU.Build.0 = Debug|Any CPU
     90    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Debug|x64.ActiveCfg = Debug|x64
     91    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Debug|x64.Build.0 = Debug|x64
     92    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Debug|x86.ActiveCfg = Debug|x86
     93    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Debug|x86.Build.0 = Debug|x86
     94    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Release|Any CPU.ActiveCfg = Release|Any CPU
     95    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Release|Any CPU.Build.0 = Release|Any CPU
     96    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Release|x64.ActiveCfg = Release|x64
     97    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Release|x64.Build.0 = Release|x64
     98    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Release|x86.ActiveCfg = Release|x86
     99    {3540E29E-4793-49E7-8EE2-FEA7F61C3994}.Release|x86.Build.0 = Release|x86
     100    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     101    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
     102    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Debug|x64.ActiveCfg = Debug|x64
     103    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Debug|x64.Build.0 = Debug|x64
     104    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Debug|x86.ActiveCfg = Debug|x86
     105    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Debug|x86.Build.0 = Debug|x86
     106    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
     107    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Release|Any CPU.Build.0 = Release|Any CPU
     108    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Release|x64.ActiveCfg = Release|x64
     109    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Release|x64.Build.0 = Release|x64
     110    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Release|x86.ActiveCfg = Release|x86
     111    {CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}.Release|x86.Build.0 = Release|x86
    74112  EndGlobalSection
    75113  GlobalSection(SolutionProperties) = preSolution
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs

    r7438 r7443  
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3232using HeuristicLab.PluginInfrastructure;
     33using HeuristicLab.Problems.Instances;
    3334
    3435namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
     
    8283      get { return (FixedValueParameter<DoubleValue>)Parameters["OverbookedCapacityPenalty"]; }
    8384    }
    84     public OptionalValueParameter<IItem> BestKnownSolutionParameter {
    85       get { return (OptionalValueParameter<IItem>)Parameters["BestKnownSolution"]; }
     85    public OptionalValueParameter<GQAPSolution> BestKnownSolutionParameter {
     86      get { return (OptionalValueParameter<GQAPSolution>)Parameters["BestKnownSolution"]; }
    8687    }
    8788    public OptionalValueParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter {
     
    117118      set { CapacitiesParameter.Value = value; }
    118119    }
    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; }
    126127    }
    127128    public StringArray EquipmentNames {
     
    132133      get { return LocationNamesParameter.Value; }
    133134      set { LocationNamesParameter.Value = value; }
     135    }
     136    public GQAPSolution BestKnownSolution {
     137      get { return BestKnownSolutionParameter.Value; }
     138      set { BestKnownSolutionParameter.Value = value; }
    134139    }
    135140    #endregion
     
    157162      Parameters.Add(new ValueParameter<DoubleArray>("Demands", DemandsDescription, new DoubleArray(), false));
    158163      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));
    160165      Parameters.Add(new OptionalValueParameter<GQAPAssignmentArchive>("BestKnownSolutions", BestKnownSolutionsDescription, null, false));
    161166      Parameters.Add(new OptionalValueParameter<StringArray>("EquipmentNames", EquipmentNamesDescription, null, false));
    162167      Parameters.Add(new OptionalValueParameter<StringArray>("LocationNames", LocationNamesDescription, null, false));
    163 
    164       BestKnownQualityParameter.Value = null;
    165168
    166169      WeightsParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false;
     
    182185      InstallationCosts = new DoubleMatrix(5, 3);
    183186
    184       TransportationCosts = 1;
    185 
    186187      Demands = new DoubleArray(5);
    187188      Demands[0] = 2; Demands[1] = 1; Demands[2] = 3; Demands[3] = 1; Demands[4] = 1;
     
    198199    public override IDeepCloneable Clone(Cloner cloner) {
    199200      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      }
    200219    }
    201220
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj

    r7438 r7443  
    166166      <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3</Name>
    167167    </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>
    168172  </ItemGroup>
    169173  <ItemGroup />
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Interfaces/IBestKnownSolutionAwareGQAPOperator.cs

    r7419 r7443  
    2121
    2222using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.IntegerVectorEncoding;
    2423
    2524namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    2625  public interface IBestKnownSolutionAwareGQAPOperator : IGQAPOperator {
    27     ILookupParameter<IntegerVector> BestKnownSolutionParameter { get; }
     26    ILookupParameter<GQAPSolution> BestKnownSolutionParameter { get; }
    2827  }
    2928}
Note: See TracChangeset for help on using the changeset viewer.