Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7445


Ignore:
Timestamp:
02/03/12 16:19:24 (13 years ago)
Author:
abeham
Message:

#1614

  • updated problem instance provider
Location:
branches/GeneralizedQAP
Files:
13 added
10 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3.csproj

    r7418 r7445  
    8888  </ItemGroup>
    8989  <ItemGroup>
     90    <Compile Include="GQAPProblemView.cs">
     91      <SubType>UserControl</SubType>
     92    </Compile>
     93    <Compile Include="GQAPProblemView.Designer.cs">
     94      <DependentUpon>GQAPProblemView.cs</DependentUpon>
     95    </Compile>
    9096    <Compile Include="GQAPAssignmentArchiveView.cs">
    9197      <SubType>UserControl</SubType>
     
    113119      <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3</Name>
    114120    </ProjectReference>
     121    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
     122      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
     123      <Name>HeuristicLab.Problems.Instances-3.3</Name>
     124    </ProjectReference>
    115125  </ItemGroup>
    116126  <ItemGroup>
     127    <EmbeddedResource Include="GQAPProblemView.resx">
     128      <DependentUpon>GQAPProblemView.cs</DependentUpon>
     129    </EmbeddedResource>
    117130    <EmbeddedResource Include="GQAPAssignmentArchiveView.resx">
    118131      <DependentUpon>GQAPAssignmentArchiveView.cs</DependentUpon>
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs

    r7443 r7445  
    201201    }
    202202
    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);
     203    public void LoadFrom(IQAPInstance instance) {
     204      Weights = new DoubleMatrix(instance.Weights);
     205      Distances = new DoubleMatrix(instance.Distances);
     206      InstallationCosts = new DoubleMatrix(Weights.Rows, Distances.Columns); // all zero
    207207      Capacities = new DoubleArray(Enumerable.Range(0, Distances.Rows).Select(x => 1.0).ToArray());
    208208      Demands = new DoubleArray(Enumerable.Range(0, Weights.Rows).Select(x => 1.0).ToArray());
    209209
    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       }
     210      TransportationCosts.Value = 1;
     211
     212      if (instance.BestKnownAssignment != null) {
     213        EvaluateAndLoadAssignment(instance.BestKnownAssignment);
     214      }
     215    }
     216
     217    public void LoadFrom(ICTAPInstance instance) {
     218      Capacities = new DoubleArray(instance.MemoryCapacities);
     219      Demands = new DoubleArray(instance.MemoryRequirements);
     220      Weights = new DoubleMatrix(instance.CommunicationCosts);
     221      InstallationCosts = new DoubleMatrix(instance.ExecutionCosts);
     222      Distances = new DoubleMatrix(Capacities.Length, Capacities.Length); // all one, except diagonal
     223      for (int i = 0; i < Capacities.Length - 1; i++)
     224        for (int j = i + 1; j < Capacities.Length; j++) {
     225          Distances[i, j] = 1;
     226          Distances[j, i] = 1;
     227        }
     228
     229      TransportationCosts.Value = 1;
     230
     231      if (instance.BestKnownAssignment != null) {
     232        EvaluateAndLoadAssignment(instance.BestKnownAssignment);
     233      }
     234    }
     235
     236    private void EvaluateAndLoadAssignment(int[] vector) {
     237      var assignment = new IntegerVector(vector);
     238      double flowDistanceQuality, installationQuality, overbookedCapacity;
     239      GQAPEvaluator.Evaluate(assignment, Weights, Distances, InstallationCosts, Demands, Capacities,
     240        out flowDistanceQuality, out installationQuality, out overbookedCapacity);
     241      double quality = GQAPEvaluator.GetCombinedQuality(flowDistanceQuality, installationQuality, overbookedCapacity, TransportationCosts.Value, OverbookedCapacityPenalty.Value);
     242      BestKnownSolution = new GQAPSolution(assignment, new DoubleValue(quality), new DoubleValue(flowDistanceQuality), new DoubleValue(installationQuality), new DoubleValue(overbookedCapacity));
     243      BestKnownQuality = new DoubleValue(quality);
    219244    }
    220245
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/HeuristicLab.Problems.Instances.ElloumiCTAP-3.3.csproj

    r7444 r7445  
    4646  </ItemGroup>
    4747  <ItemGroup>
    48     <Compile Include="SolutionParser.cs" />
     48    <Compile Include="ElloumiCTAPSolutionParser.cs" />
    4949    <EmbeddedResource Include="Data\tass1003Aa.dat" />
    5050    <EmbeddedResource Include="Data\tass1003Ab.dat" />
     
    130130    <EmbeddedResource Include="Data\tassc2005De.dat" />
    131131    <None Include="Plugin.cs.frame" />
    132     <Compile Include="Instance.cs" />
    133     <Compile Include="InstanceDescriptor.cs" />
    134     <Compile Include="InstanceProvider.cs" />
    135     <Compile Include="Parser.cs" />
     132    <Compile Include="ElloumiCTAPInstance.cs" />
     133    <Compile Include="ElloumiCTAPInstanceDescriptor.cs" />
     134    <Compile Include="ElloumiCTAPInstanceProvider.cs" />
     135    <Compile Include="ElloumiCTAPParser.cs" />
    136136    <Compile Include="Plugin.cs" />
    137137    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3/HeuristicLab.Problems.Instances.QAPLIB-3.3.csproj

    r7443 r7445  
    4747  </ItemGroup>
    4848  <ItemGroup>
    49     <Compile Include="Parser.cs" />
    50     <Compile Include="Instance.cs" />
    51     <Compile Include="InstanceDescriptor.cs" />
    52     <Compile Include="SolutionParser.cs" />
    53     <Compile Include="InstanceProvider.cs" />
     49    <Compile Include="QAPLIBParser.cs" />
     50    <Compile Include="QAPLIBInstance.cs" />
     51    <Compile Include="QAPLIBInstanceDescriptor.cs" />
     52    <Compile Include="QAPLIBSolutionParser.cs" />
     53    <Compile Include="QAPLIBInstanceProvider.cs" />
    5454    <EmbeddedResource Include="Data\bur26a.dat" />
    5555    <EmbeddedResource Include="Data\bur26b.dat" />
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3/Plugin.cs

    r7444 r7445  
    2323
    2424namespace HeuristicLab.Problems.Instances {
    25   [Plugin("HeuristicLab.Problems.Instances.QAPLIB", "3.3.6.7443")]
     25  [Plugin("HeuristicLab.Problems.Instances.QAPLIB", "3.3.6.7444")]
    2626  [PluginFile("HeuristicLab.Problems.Instances.QAPLIB-3.3.dll", PluginFileType.Assembly)]
    2727  public class HeuristicLabProblemsInstancesQAPLIBPlugin : PluginBase {
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/HeuristicLab.Problems.Instances-3.3.csproj

    r7444 r7445  
    4040    <Reference Include="HeuristicLab.Common-3.3">
    4141      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
    42       <Private>False</Private>
    43     </Reference>
    44     <Reference Include="HeuristicLab.Core-3.3">
    45       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
    4642      <Private>False</Private>
    4743    </Reference>
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/IProblemInstanceProvider.cs

    r7443 r7445  
    2424
    2525namespace HeuristicLab.Problems.Instances {
    26   public interface IProblemInstanceProvider<TInstance> {
     26  public interface IProblemInstanceProvider {
    2727    string Name { get; }
    2828    string Description { get; }
     
    3030
    3131    IEnumerable<IInstanceDescriptor> GetInstanceDescriptors();
     32  }
     33
     34  public interface IProblemInstanceProvider<TInstance> : IProblemInstanceProvider {
    3235    TInstance GetInstance(IInstanceDescriptor descriptor);
    3336  }
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/Instances/ICTAPInstance.cs

    r7443 r7445  
    5555    /// Optional! The quality value of the <see cref="BestKnownAssignment"/>
    5656    /// </summary>
    57     double BestKnownQuality { get; }
     57    double? BestKnownQuality { get; }
    5858  }
    5959}
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/Instances/IQAPInstance.cs

    r7443 r7445  
    4747    /// Optional! The quality value of the <see cref="BestKnownAssignment"/>
    4848    /// </summary>
    49     double BestKnownQuality { get; }
     49    double? BestKnownQuality { get; }
    5050  }
    5151}
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/Plugin.cs

    r7444 r7445  
    2323
    2424namespace HeuristicLab.Problems.Instances {
    25   [Plugin("HeuristicLab.Problems.Instances", "3.3.6.7443")]
     25  [Plugin("HeuristicLab.Problems.Instances", "3.3.6.7444")]
    2626  [PluginFile("HeuristicLab.Problems.Instances-3.3.dll", PluginFileType.Assembly)]
    2727  public class HeuristicLabProblemsInstancesPlugin : PluginBase {
Note: See TracChangeset for help on using the changeset viewer.