Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7466


Ignore:
Timestamp:
02/13/12 16:35:13 (12 years ago)
Author:
abeham
Message:

#1614

  • included TSLIB's ATSP and CVRP problems as well
Location:
branches/GeneralizedQAP
Files:
7 added
3 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ProblemInstanceProviderView.cs

    r7448 r7466  
    5959    private void loadButton_Click(object sender, EventArgs e) {
    6060      var instance = (IInstanceDescriptor)instancesComboBox.SelectedItem;
    61       Content.FeedConsumer(instance);
     61      if (!Content.FeedConsumer(instance)) {
     62        MessageBox.Show("Loading the problem instance " + instance.Name + " failed.");
     63      }
    6264    }
    6365
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs

    r7448 r7466  
    3838  [Creatable("Problems")]
    3939  [StorableClass]
    40   public sealed class GeneralizedQuadraticAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<IGQAPEvaluator, IGQAPSolutionCreator>, IStorableContent, IProblemInstanceConsumer<IQAPInstance>, IProblemInstanceConsumer<ICTAPInstance> {
     40  public sealed class GeneralizedQuadraticAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<IGQAPEvaluator, IGQAPSolutionCreator>, IStorableContent, IProblemInstanceConsumer<IQAPInstance>, IProblemInstanceConsumer<ICTAPInstance>, IProblemInstanceConsumer<ITSPInstance>, IProblemInstanceConsumer<IATSPInstance> {
    4141
    4242    public override Image ItemImage {
     
    206206    }
    207207
    208     public void LoadFrom(IQAPInstance instance) {
    209       Name = instance.Name;
    210       Description = instance.Description;
    211 
    212       Weights = new DoubleMatrix(instance.Weights);
    213       Distances = new DoubleMatrix(instance.Distances);
    214       InstallationCosts = new DoubleMatrix(Weights.Rows, Distances.Columns); // all zero
    215       Capacities = new DoubleArray(Enumerable.Range(0, Distances.Rows).Select(x => 1.0).ToArray());
    216       Demands = new DoubleArray(Enumerable.Range(0, Weights.Rows).Select(x => 1.0).ToArray());
    217 
    218       TransportationCosts.Value = 1;
    219 
    220       if (instance.BestKnownAssignment != null) {
    221         EvaluateAndLoadAssignment(instance.BestKnownAssignment);
    222       } else {
    223         BestKnownQuality = null;
    224         BestKnownSolution = null;
    225         BestKnownSolutions = null;
    226       }
    227     }
    228 
    229     public void LoadFrom(ICTAPInstance instance) {
    230       Name = instance.Name;
    231       Description = instance.Description;
    232 
    233       Capacities = new DoubleArray(instance.MemoryCapacities);
    234       Demands = new DoubleArray(instance.MemoryRequirements);
    235       Weights = new DoubleMatrix(instance.CommunicationCosts);
    236       InstallationCosts = new DoubleMatrix(instance.ExecutionCosts.Transpose());
    237       Distances = new DoubleMatrix(Capacities.Length, Capacities.Length); // all one, except diagonal
    238       for (int i = 0; i < Capacities.Length - 1; i++)
    239         for (int j = i + 1; j < Capacities.Length; j++) {
    240           Distances[i, j] = 1;
    241           Distances[j, i] = 1;
    242         }
    243 
    244       TransportationCosts.Value = 1;
    245 
    246       if (instance.BestKnownAssignment != null) {
    247         EvaluateAndLoadAssignment(instance.BestKnownAssignment);
    248       } else {
    249         BestKnownQuality = null;
    250         BestKnownSolution = null;
    251         BestKnownSolutions = null;
    252       }
     208    public bool LoadFrom(IQAPInstance instance) {
     209      try {
     210        Name = instance.Name;
     211        Description = instance.Description;
     212
     213        Weights = new DoubleMatrix(instance.Weights);
     214        Distances = new DoubleMatrix(instance.Distances);
     215        InstallationCosts = new DoubleMatrix(Weights.Rows, Distances.Columns); // all zero
     216        Capacities = new DoubleArray(Enumerable.Range(0, Distances.Rows).Select(x => 1.0).ToArray());
     217        Demands = new DoubleArray(Enumerable.Range(0, Weights.Rows).Select(x => 1.0).ToArray());
     218
     219        TransportationCosts.Value = 1;
     220
     221        if (instance.BestKnownAssignment != null) {
     222          EvaluateAndLoadAssignment(instance.BestKnownAssignment);
     223        } else {
     224          BestKnownQuality = null;
     225          BestKnownSolution = null;
     226          BestKnownSolutions = null;
     227        }
     228      } catch {
     229        return false;
     230      }
     231      return true;
     232    }
     233
     234    public bool LoadFrom(ICTAPInstance instance) {
     235      try {
     236        Name = instance.Name;
     237        Description = instance.Description;
     238
     239        Capacities = new DoubleArray(instance.MemoryCapacities);
     240        Demands = new DoubleArray(instance.MemoryRequirements);
     241        Weights = new DoubleMatrix(instance.CommunicationCosts);
     242        InstallationCosts = new DoubleMatrix(instance.ExecutionCosts.Transpose());
     243        Distances = new DoubleMatrix(Capacities.Length, Capacities.Length); // all one, except diagonal
     244        for (int i = 0; i < Capacities.Length - 1; i++)
     245          for (int j = i + 1; j < Capacities.Length; j++) {
     246            Distances[i, j] = 1;
     247            Distances[j, i] = 1;
     248          }
     249
     250        TransportationCosts.Value = 1;
     251
     252        if (instance.BestKnownAssignment != null) {
     253          EvaluateAndLoadAssignment(instance.BestKnownAssignment);
     254        } else {
     255          BestKnownQuality = null;
     256          BestKnownSolution = null;
     257          BestKnownSolutions = null;
     258        }
     259      } catch {
     260        return false;
     261      }
     262      return true;
     263    }
     264
     265    public bool LoadFrom(ITSPInstance instance) {
     266      try {
     267        if (instance.Dimension > 1000) return false;
     268       
     269        Name = instance.Name;
     270        Description = instance.Description;
     271
     272        Capacities = new DoubleArray(instance.Dimension);
     273        Demands = new DoubleArray(instance.Dimension);
     274        for (int i = 0; i < instance.Dimension; i++) {
     275          Capacities[i] = 1;
     276          Demands[i] = 1;
     277        }
     278        InstallationCosts = new DoubleMatrix(instance.Dimension, instance.Dimension);
     279        Weights = new DoubleMatrix(instance.Dimension, instance.Dimension);
     280        for (int i = 0; i < instance.Dimension; i++)
     281          Weights[i, (i + 1) % instance.Dimension] = 1;
     282        Distances = new DoubleMatrix(instance.GetDistanceMatrix());
     283
     284        TransportationCosts.Value = 1;
     285
     286        if (instance.BestKnownTour != null) {
     287          EvaluateAndLoadAssignment(instance.BestKnownTour);
     288        } else {
     289          BestKnownQuality = null;
     290          BestKnownSolution = null;
     291          BestKnownSolutions = null;
     292        }
     293      } catch {
     294        return false;
     295      }
     296      return true;
     297    }
     298
     299    public bool LoadFrom(IATSPInstance instance) {
     300      try {
     301        Name = instance.Name;
     302        Description = instance.Description;
     303
     304        Capacities = new DoubleArray(instance.Dimension);
     305        Demands = new DoubleArray(instance.Dimension);
     306        for (int i = 0; i < instance.Dimension; i++) {
     307          Capacities[i] = 1;
     308          Demands[i] = 1;
     309        }
     310        InstallationCosts = new DoubleMatrix(instance.Dimension, instance.Dimension);
     311        Weights = new DoubleMatrix(instance.Dimension, instance.Dimension);
     312        for (int i = 0; i < instance.Dimension; i++)
     313          Weights[i, (i + 1) % instance.Dimension] = 1;
     314        Distances = new DoubleMatrix(instance.Distances);
     315
     316        TransportationCosts.Value = 1;
     317
     318        if (instance.BestKnownTour != null) {
     319          EvaluateAndLoadAssignment(instance.BestKnownTour);
     320        } else {
     321          BestKnownQuality = null;
     322          BestKnownSolution = null;
     323          BestKnownSolutions = null;
     324        }
     325      } catch {
     326        return false;
     327      }
     328      return true;
    253329    }
    254330
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/ElloumiCTAPInstance.cs

    r7445 r7466  
    2222namespace HeuristicLab.Problems.Instances.ElloumiCTAP {
    2323  internal class ElloumiCTAPInstance : ICTAPInstance {
    24     public string Name { get; internal set; }
    25     public string Description { get; internal set; }
    26     public double[,] ExecutionCosts { get; internal set; }
    27     public double[,] CommunicationCosts { get; internal set; }
    28     public double[] MemoryRequirements { get; internal set; }
    29     public double[] MemoryCapacities { get; internal set; }
    30     public int[] BestKnownAssignment { get; internal set; }
    31     public double? BestKnownQuality { get; internal set; }
     24    public string Name { get; set; }
     25    public string Description { get; set; }
     26    public int Processors { get; set; }
     27    public int Tasks { get; set; }
     28    public double[,] ExecutionCosts { get; set; }
     29    public double[,] CommunicationCosts { get; set; }
     30    public double[] MemoryRequirements { get; set; }
     31    public double[] MemoryCapacities { get; set; }
     32    public int[] BestKnownAssignment { get; set; }
     33    public double? BestKnownQuality { get; set; }
    3234  }
    3335}
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/ElloumiCTAPInstanceProvider.cs

    r7448 r7466  
    2828
    2929namespace HeuristicLab.Problems.Instances.ElloumiCTAP {
    30   public class ElloumiCTAPInstanceProvider : IProblemInstanceProvider<ICTAPInstance> {
    31     private IProblemInstanceConsumer<ICTAPInstance> consumer;
    32 
    33     public string Name {
     30  public class ElloumiCTAPInstanceProvider : ProblemInstanceProvider<ICTAPInstance> {
     31    public override string Name {
    3432      get { return "Elloumi's CTAP instances"; }
    3533    }
    3634
    37     public string Description {
     35    public override string Description {
    3836      get { return "CTAP instances published by Sourour Elloumi"; }
    3937    }
    4038
    41     public Uri Link {
     39    public override Uri Link {
    4240      get { return new Uri("http://cedric.cnam.fr/oc/TAP/TAP.html"); }
    4341    }
    4442
    45     public bool ConsumerCanBeFed {
    46       get { return consumer != null; }
    47     }
    48 
    49     public void SetConsumer(IProblemInstanceConsumer consumer) {
    50       if (consumer is IProblemInstanceConsumer<ICTAPInstance>)
    51         this.consumer = (IProblemInstanceConsumer<ICTAPInstance>)consumer;
    52       else this.consumer = null;
    53     }
    54 
    55     public void FeedConsumer(IInstanceDescriptor descriptor) {
    56       consumer.LoadFrom(GetInstance(descriptor));
    57     }
    58 
    59     public IEnumerable<IInstanceDescriptor> GetInstanceDescriptors() {
     43    public override IEnumerable<IInstanceDescriptor> GetInstanceDescriptors() {
    6044      var solutions = Assembly.GetExecutingAssembly()
    6145        .GetManifestResourceNames()
     
    7054    }
    7155
    72     public ICTAPInstance GetInstance(IInstanceDescriptor id) {
     56    public override ICTAPInstance GetInstance(IInstanceDescriptor id) {
    7357      var descriptor = (ElloumiCTAPInstanceDescriptor)id;
    7458      var instance = new ElloumiCTAPInstance();
     
    7862        datParser.Parse(stream);
    7963        if (datParser.Error != null) throw datParser.Error;
     64        instance.Processors = datParser.Processors;
     65        instance.Tasks = datParser.Tasks;
    8066        instance.ExecutionCosts = datParser.ExecutionCosts;
    8167        instance.CommunicationCosts = datParser.CommunicationCosts;
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3

    • Property svn:ignore
      •  

        old new  
        11*.user
        22obj
         3Plugin.cs
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBInstance.cs

    r7445 r7466  
    2424    public string Name { get; set; }
    2525    public string Description { get; set; }
     26    public int Dimension { get; set; }
    2627    public double[,] Distances { get; set; }
    2728    public double[,] Weights { get; set; }
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBInstanceProvider.cs

    r7448 r7466  
    2828
    2929namespace HeuristicLab.Problems.Instances.QAPLIB {
    30   public class QAPLIBInstanceProvider : IProblemInstanceProvider<IQAPInstance> {
    31     IProblemInstanceConsumer<IQAPInstance> consumer;
    32 
    33     public string Name {
     30  public class QAPLIBInstanceProvider : ProblemInstanceProvider<IQAPInstance> {
     31    public override string Name {
    3432      get { return "QAPLIB"; }
    3533    }
    3634
    37     public string Description {
     35    public override string Description {
    3836      get { return "Quadratic Assignment Problem Library"; }
    3937    }
    4038
    41     public Uri Link {
     39    public override Uri Link {
    4240      get { return new Uri("http://www.seas.upenn.edu/qaplib/"); }
    4341    }
    4442
    45     public bool ConsumerCanBeFed {
    46       get { return consumer != null; }
    47     }
    48 
    49     public void SetConsumer(IProblemInstanceConsumer consumer) {
    50       if (consumer is IProblemInstanceConsumer<IQAPInstance>)
    51         this.consumer = (IProblemInstanceConsumer<IQAPInstance>)consumer;
    52       else this.consumer = null;
    53     }
    54 
    55     public void FeedConsumer(IInstanceDescriptor descriptor) {
    56       consumer.LoadFrom(GetInstance(descriptor));
    57     }
    58 
    59     public IEnumerable<IInstanceDescriptor> GetInstanceDescriptors() {
     43    public override IEnumerable<IInstanceDescriptor> GetInstanceDescriptors() {
    6044      var solutions = Assembly.GetExecutingAssembly()
    6145        .GetManifestResourceNames()
     
    7054    }
    7155
    72     public IQAPInstance GetInstance(IInstanceDescriptor id) {
     56    public override IQAPInstance GetInstance(IInstanceDescriptor id) {
    7357      var descriptor = (QAPLIBInstanceDescriptor)id;
    7458      var instance = new QAPLIBInstance();
     
    7862        datParser.Parse(stream);
    7963        if (datParser.Error != null) throw datParser.Error;
     64        instance.Dimension = datParser.Size;
    8065        instance.Distances = datParser.Distances;
    8166        instance.Weights = datParser.Weights;
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.TSPLIB/3.3/HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj

    r7465 r7466  
    4545  </ItemGroup>
    4646  <ItemGroup>
    47     <Compile Include="TSPLIBInstance.cs" />
     47    <Compile Include="TSPLIBATSPInstance.cs" />
     48    <Compile Include="TSPLIBATSPInstanceProvider.cs" />
     49    <Compile Include="TSPLIBCVRPInstance.cs" />
     50    <Compile Include="TSPLIBCVRPInstanceProvider.cs" />
     51    <Compile Include="TSPLIBTSPInstance.cs" />
    4852    <Compile Include="TSPLIBInstanceDescriptor.cs" />
    4953    <Compile Include="TSPLIBTSPInstanceProvider.cs" />
     
    192196    <EmbeddedResource Include="Data\TSP\vm1084.tsp" />
    193197    <EmbeddedResource Include="Data\TSP\vm1748.tsp" />
     198    <EmbeddedResource Include="Data\ATSP\br17.atsp" />
     199    <EmbeddedResource Include="Data\ATSP\ft53.atsp" />
     200    <EmbeddedResource Include="Data\ATSP\ft70.atsp" />
     201    <EmbeddedResource Include="Data\ATSP\ftv170.atsp" />
     202    <EmbeddedResource Include="Data\ATSP\ftv33.atsp" />
     203    <EmbeddedResource Include="Data\ATSP\ftv35.atsp" />
     204    <EmbeddedResource Include="Data\ATSP\ftv38.atsp" />
     205    <EmbeddedResource Include="Data\ATSP\ftv44.atsp" />
     206    <EmbeddedResource Include="Data\ATSP\ftv47.atsp" />
     207    <EmbeddedResource Include="Data\ATSP\ftv55.atsp" />
     208    <EmbeddedResource Include="Data\ATSP\ftv64.atsp" />
     209    <EmbeddedResource Include="Data\ATSP\ftv70.atsp" />
     210    <EmbeddedResource Include="Data\ATSP\kro124p.atsp" />
     211    <EmbeddedResource Include="Data\ATSP\p43.atsp" />
     212    <EmbeddedResource Include="Data\ATSP\rbg323.atsp" />
     213    <EmbeddedResource Include="Data\ATSP\rbg358.atsp" />
     214    <EmbeddedResource Include="Data\ATSP\rbg403.atsp" />
     215    <EmbeddedResource Include="Data\ATSP\rbg443.atsp" />
     216    <EmbeddedResource Include="Data\ATSP\ry48p.atsp" />
     217    <EmbeddedResource Include="Data\CVRP\att48.vrp" />
     218    <EmbeddedResource Include="Data\CVRP\eil13.vrp" />
     219    <EmbeddedResource Include="Data\CVRP\eil22.vrp" />
     220    <EmbeddedResource Include="Data\CVRP\eil23.vrp" />
     221    <EmbeddedResource Include="Data\CVRP\eil30.vrp" />
     222    <EmbeddedResource Include="Data\CVRP\eil31.vrp" />
     223    <EmbeddedResource Include="Data\CVRP\eil33.vrp" />
     224    <EmbeddedResource Include="Data\CVRP\eil51.vrp" />
     225    <EmbeddedResource Include="Data\CVRP\eil7.vrp" />
     226    <EmbeddedResource Include="Data\CVRP\eilA101.vrp" />
     227    <EmbeddedResource Include="Data\CVRP\eilA76.vrp" />
     228    <EmbeddedResource Include="Data\CVRP\eilB101.vrp" />
     229    <EmbeddedResource Include="Data\CVRP\eilB76.vrp" />
     230    <EmbeddedResource Include="Data\CVRP\eilC76.vrp" />
     231    <EmbeddedResource Include="Data\CVRP\eilD76.vrp" />
     232    <EmbeddedResource Include="Data\CVRP\gil262.vrp" />
    194233    <None Include="Plugin.cs.frame" />
    195234    <Compile Include="Plugin.cs" />
     
    206245    </ProjectReference>
    207246  </ItemGroup>
    208   <ItemGroup>
    209     <Folder Include="Data\ATSP\" />
    210     <Folder Include="Data\CVRP\" />
    211   </ItemGroup>
     247  <ItemGroup />
    212248  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    213249  <PropertyGroup>
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBParser.cs

    r7465 r7466  
    525525        || edgeWeightFormat == TSPLIBEdgeWeightFormats.UPPER_ROW;
    526526
    527       int dim1 = !upperTriangular ? (diagonal ? 0 : 1) : 0;
    528       int dim2 = upperTriangular ? (diagonal ? 0 : 1) : 0;
     527      int dim1 = !triangular && !upperTriangular ? (diagonal ? 0 : 1) : 0;
     528      int dim2 = !triangular && upperTriangular ? (diagonal ? 0 : 1) : 0;
    529529      bool finished = false;
    530530      while (!finished) {
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBTSPInstanceProvider.cs

    r7465 r7466  
    4545      var solutions = Assembly.GetExecutingAssembly()
    4646        .GetManifestResourceNames()
     47        .Where(x => Regex.Match(x, @".*\.Data\.TSP\..*").Success)
    4748        .Where(x => x.EndsWith(".opt.tour"))
    4849        .ToDictionary(x => x.Substring(0, x.Length - ".opt.tour".Length) + ".tsp", x => x);
    4950
    5051      return Assembly.GetExecutingAssembly()
    51           .GetManifestResourceNames()
    52           .Where(x => x.EndsWith(".tsp"))
    53           .OrderBy(x => x)
    54           .Select(x => new TSPLIBInstanceDescriptor(GetPrettyName(x), GetDescription(), x, solutions.ContainsKey(x) ? solutions[x] : String.Empty));
     52        .GetManifestResourceNames()
     53        .Where(x => Regex.Match(x, @".*\.Data\.TSP\..*").Success)
     54        .Where(x => x.EndsWith(".tsp"))
     55        .OrderBy(x => x)
     56        .Select(x => new TSPLIBInstanceDescriptor(GetPrettyName(x), GetDescription(), x, solutions.ContainsKey(x) ? solutions[x] : String.Empty));
    5557    }
    5658
    5759    public override ITSPInstance GetInstance(IInstanceDescriptor id) {
    5860      var descriptor = (TSPLIBInstanceDescriptor)id;
    59       var instance = new TSPLIBInstance();
     61      var instance = new TSPLIBTSPInstance();
    6062      using (var stream = Assembly.GetExecutingAssembly()
    6163        .GetManifestResourceStream(descriptor.InstanceIdentifier)) {
    62         var tspParser = new TSPLIBParser(stream);
    63         tspParser.Parse();
    64         instance.Coordinates = tspParser.Vertices != null ? tspParser.Vertices : tspParser.DisplayVertices;
    65         instance.Distances = tspParser.Distances;
     64        var parser = new TSPLIBParser(stream);
     65        parser.Parse();
     66        instance.Dimension = parser.Dimension;
     67        instance.Coordinates = parser.Vertices != null ? parser.Vertices : parser.DisplayVertices;
     68        instance.Distances = parser.Distances;
     69        switch (parser.EdgeWeightType) {
     70          case TSPLIBEdgeWeightTypes.ATT:
     71            instance.DistanceMeasure = TSPDistanceMeasure.Att; break;
     72          case TSPLIBEdgeWeightTypes.CEIL_2D:
     73            instance.DistanceMeasure = TSPDistanceMeasure.UpperEuclidean; break;
     74          case TSPLIBEdgeWeightTypes.EUC_2D:
     75            instance.DistanceMeasure = TSPDistanceMeasure.RoundedEuclidean; break;
     76          case TSPLIBEdgeWeightTypes.EUC_3D:
     77            throw new InvalidDataException("3D coordinates are not supported.");
     78          case TSPLIBEdgeWeightTypes.EXPLICIT:
     79            instance.DistanceMeasure = TSPDistanceMeasure.Direct; break;
     80          case TSPLIBEdgeWeightTypes.GEO:
     81            instance.DistanceMeasure = TSPDistanceMeasure.Geo; break;
     82          case TSPLIBEdgeWeightTypes.MAN_2D:
     83            instance.DistanceMeasure = TSPDistanceMeasure.Manhattan; break;
     84          case TSPLIBEdgeWeightTypes.MAN_3D:
     85            throw new InvalidDataException("3D coordinates are not supported.");
     86          case TSPLIBEdgeWeightTypes.MAX_2D:
     87            instance.DistanceMeasure = TSPDistanceMeasure.Maximum; break;
     88          case TSPLIBEdgeWeightTypes.MAX_3D:
     89            throw new InvalidDataException("3D coordinates are not supported.");
     90          default:
     91            throw new InvalidDataException("The given edge weight is not supported by HeuristicLab.");
     92        }
    6693
    67         instance.Name = tspParser.Name;
    68         instance.Description = tspParser.Comment
     94        instance.Name = parser.Name;
     95        instance.Description = parser.Comment
    6996          + Environment.NewLine + Environment.NewLine
    7097          + GetDescription();
     
    73100          using (Stream solStream = Assembly.GetExecutingAssembly()
    74101            .GetManifestResourceStream(descriptor.SolutionIdentifier)) {
    75             var slnParser = new TSPLIBParser(solStream);
    76             slnParser.Parse();
    77             instance.BestKnownTour = slnParser.Tour[0];
     102            var tourParser = new TSPLIBParser(solStream);
     103            tourParser.Parse();
     104            instance.BestKnownTour = tourParser.Tour[0];
    78105          }
    79106        }
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3

    • Property svn:ignore
      •  

        old new  
        11obj
        22bin
         3Plugin.cs
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/HeuristicLab.Problems.Instances-3.3.csproj

    r7465 r7466  
    5252  <ItemGroup>
    5353    <None Include="Plugin.cs.frame" />
     54    <Compile Include="Instances\IATSPInstance.cs" />
    5455    <Compile Include="Instances\ICTAPInstance.cs" />
    5556    <Compile Include="IInstanceDescriptor.cs" />
     57    <Compile Include="Instances\ICVRPInstance.cs" />
    5658    <Compile Include="Instances\IQAPInstance.cs" />
    5759    <Compile Include="Instances\ITSPInstance.cs" />
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/IProblemInstanceConsumer.cs

    r7448 r7466  
    2424
    2525  public interface IProblemInstanceConsumer<TInstance> : IProblemInstanceConsumer {
    26     void LoadFrom(TInstance instance);
     26    bool LoadFrom(TInstance instance);
    2727  }
    2828}
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/IProblemInstanceProvider.cs

    r7448 r7466  
    3333
    3434    void SetConsumer(IProblemInstanceConsumer consumer);
    35     void FeedConsumer(IInstanceDescriptor descriptor);
     35    bool FeedConsumer(IInstanceDescriptor descriptor);
    3636
    3737    IEnumerable<IInstanceDescriptor> GetInstanceDescriptors();
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/Instances/ICTAPInstance.cs

    r7445 r7466  
    2121
    2222namespace HeuristicLab.Problems.Instances {
     23  /// <summary>
     24  /// Describes instances of the Capacitated Task Assignment Problem (CTAP).
     25  /// </summary>
    2326  public interface ICTAPInstance {
    2427    /// <summary>
     
    3134    string Description { get; }
    3235
     36    /// <summary>
     37    /// The number M of processors
     38    /// </summary>
     39    int Processors { get; }
     40    /// <summary>
     41    /// The number N of tasks
     42    /// </summary>
     43    int Tasks { get; }
    3344    /// <summary>
    3445    /// An MxN Matrix with M = |Processors| and N = |Tasks|
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/Instances/IQAPInstance.cs

    r7445 r7466  
    2121
    2222namespace HeuristicLab.Problems.Instances {
     23  /// <summary>
     24  /// Describes instances of the Quadratic Assignment Problem (QAP).
     25  /// </summary>
    2326  public interface IQAPInstance {
    2427    /// <summary>
     
    3134    string Description { get; }
    3235
     36    /// <summary>
     37    /// The number of facilities (and also the number of locations)
     38    /// </summary>
     39    int Dimension { get; }
    3340    /// <summary>
    3441    /// An NxN Matrix with N = |Faciliies|
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/Instances/ITSPInstance.cs

    r7465 r7466  
    2222
    2323namespace HeuristicLab.Problems.Instances {
    24   public enum TSPDistanceMeasure { Direct, Euclidean, RoundedEuclidean, Geo };
     24  public enum TSPDistanceMeasure { Direct, Euclidean, RoundedEuclidean, UpperEuclidean, Geo, Manhattan, Maximum, Att };
    2525
     26  /// <summary>
     27  /// Describes instances of the Traveling Salesman Problem (TSP).
     28  /// </summary>
    2629  public interface ITSPInstance {
    2730    /// <summary>
     
    3538
    3639    /// <summary>
     40    /// The number of cities.
     41    /// </summary>
     42    int Dimension { get; }
     43    /// <summary>
    3744    /// Specifies the distance measure that is to be used.
    38     ///
    39     /// Direct           = The distances are given in form of the distance matrix.
    40     /// Euclidean        = The distances are calculated as euclidean distance.
    41     /// RoundedEuclidean = Each individual euclidean distance is rounded before
    42     ///                    being summed.
    43     /// Geo              = The coordinates specify points on the surface of the
    44     ///                    earth and the distances are arc distances.
    4545    /// </summary>
    4646    TSPDistanceMeasure DistanceMeasure { get; }
     
    5353    double[,] Distances { get; }
    5454    /// <summary>
    55     /// Optional! A a matrix of dimension [N, 2] where each row is one of the cities
     55    /// Optional! A a matrix of dimension [N, 2] matrix where each row is one of the cities
    5656    /// and the colmns represent x and y coordinates respectively.
    5757    /// </summary>
     
    7474    /// </summary>
    7575    double? BestKnownQuality { get; }
     76
     77    /// <summary>
     78    /// If only the coordinates are given, can calculate the distance matrix.
     79    /// </summary>
     80    /// <returns>A full distance matrix between all cities.</returns>
     81    double[,] GetDistanceMatrix();
    7682  }
    7783}
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/ProblemInstanceProvider.cs

    r7465 r7466  
    4141    }
    4242
    43     public void FeedConsumer(IInstanceDescriptor descriptor) {
    44       Consumer.LoadFrom(GetInstance(descriptor));
     43    public bool FeedConsumer(IInstanceDescriptor descriptor) {
     44      return Consumer.LoadFrom(GetInstance(descriptor));
    4545    }
    4646
Note: See TracChangeset for help on using the changeset viewer.