Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11289 for branches


Ignore:
Timestamp:
08/20/14 09:30:37 (10 years ago)
Author:
pfleck
Message:

#2208 merged changes from #2225 to enable all CVRP provider for the orienteering problem.

Location:
branches/HeuristicLab.Problems.Orienteering
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering

  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances

  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/CordeauFormat/CordeauFormatInstanceProvider.cs

    r11185 r11289  
    2323
    2424namespace HeuristicLab.Problems.Instances.VehicleRouting {
    25   public abstract class CordeauFormatInstanceProvider : VRPInstanceProvider {
    26     protected override VRPData LoadData(Stream stream) {
     25  public abstract class CordeauFormatInstanceProvider : VRPInstanceProvider<MDCVRPTWData> {
     26    protected override MDCVRPTWData LoadData(Stream stream) {
    2727      return LoadInstance(new CordeauParser(stream));
    2828    }
     
    3131      get { return true; }
    3232    }
    33     public override VRPData ImportData(string path) {
     33    public override MDCVRPTWData ImportData(string path) {
    3434      return LoadInstance(new CordeauParser(path));
    3535    }
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/GoldenFormatInstanceProvider.cs

    r11185 r11289  
    2424
    2525namespace HeuristicLab.Problems.Instances.VehicleRouting {
    26   public abstract class GoldenFormatInstanceProvider : VRPInstanceProvider {
    27     protected override VRPData LoadData(Stream stream) {
     26  public abstract class GoldenFormatInstanceProvider : VRPInstanceProvider<CVRPTWData> {
     27    protected override CVRPTWData LoadData(Stream stream) {
    2828      return LoadInstance(new GoldenParser(stream));
    2929    }
     
    3232      get { return true; }
    3333    }
    34     public override VRPData ImportData(string path) {
     34    public override CVRPTWData ImportData(string path) {
    3535      return LoadInstance(new GoldenParser(path));
    3636    }
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/LiLimFormat/LiLimFormatInstanceProvider.cs

    r11185 r11289  
    2323
    2424namespace HeuristicLab.Problems.Instances.VehicleRouting {
    25   public abstract class LiLimFormatInstanceProvider : VRPInstanceProvider {
    26     protected override VRPData LoadData(Stream stream) {
     25  public abstract class LiLimFormatInstanceProvider : VRPInstanceProvider<PDPTWData> {
     26    protected override PDPTWData LoadData(Stream stream) {
    2727      return LoadInstance(new LiLimParser(stream));
    2828    }
     
    3131      get { return true; }
    3232    }
    33     public override VRPData ImportData(string path) {
     33    public override PDPTWData ImportData(string path) {
    3434      return LoadInstance(new LiLimParser(path));
    3535    }
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonFormatInstanceProvider.cs

    r11185 r11289  
    2323
    2424namespace HeuristicLab.Problems.Instances.VehicleRouting {
    25   public abstract class SolomonFormatInstanceProvider : VRPInstanceProvider {
    26     protected override VRPData LoadData(Stream stream) {
     25  public abstract class SolomonFormatInstanceProvider : VRPInstanceProvider<CVRPTWData> {
     26    protected override CVRPTWData LoadData(Stream stream) {
    2727      return LoadInstance(new SolomonParser(stream));
    2828    }
     
    3131      get { return true; }
    3232    }
    33     public override VRPData ImportData(string path) {
     33    public override CVRPTWData ImportData(string path) {
    3434      return LoadInstance(new SolomonParser(path));
    3535    }
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/TSPLibFormatInstanceProvider.cs

    r11185 r11289  
    2525
    2626namespace HeuristicLab.Problems.Instances.VehicleRouting {
    27   public abstract class TSPLibFormatInstanceProvider : VRPInstanceProvider {
    28     protected override VRPData LoadData(Stream stream) {
     27  public abstract class TSPLibFormatInstanceProvider : VRPInstanceProvider<CVRPData> {
     28    protected override CVRPData LoadData(Stream stream) {
    2929      return LoadInstance(new TSPLIBParser(stream));
    3030    }
     
    3333      get { return true; }
    3434    }
    35     public override VRPData ImportData(string path) {
     35    public override CVRPData ImportData(string path) {
    3636      return LoadInstance(new TSPLIBParser(path));
    3737    }
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TaillardFormat/TaillardFormatInstanceProvider.cs

    r11185 r11289  
    2323
    2424namespace HeuristicLab.Problems.Instances.VehicleRouting {
    25   public abstract class TaillardFormatInstanceProvider : VRPInstanceProvider {
    26     protected override VRPData LoadData(Stream stream) {
     25  public abstract class TaillardFormatInstanceProvider : VRPInstanceProvider<CVRPData> {
     26    protected override CVRPData LoadData(Stream stream) {
    2727      return LoadInstance(new TaillardParser(stream));
    2828    }
     
    3131      get { return true; }
    3232    }
    33     public override VRPData ImportData(string path) {
     33    public override CVRPData ImportData(string path) {
    3434      return LoadInstance(new TaillardParser(path));
    3535    }
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/VRPInstanceProvider.cs

    r11185 r11289  
    2929
    3030namespace HeuristicLab.Problems.Instances.VehicleRouting {
    31   public abstract class VRPInstanceProvider : ProblemInstanceProvider<VRPData>, IVRPInstanceProvider {
     31  public abstract class VRPInstanceProvider<T> : ProblemInstanceProvider<T>, IVRPInstanceProvider where T : IVRPData {
    3232    protected abstract string FileName { get; }
    3333
     
    5252    }
    5353
    54     public override VRPData LoadData(IDataDescriptor id) {
     54    public override T LoadData(IDataDescriptor id) {
    5555      var descriptor = (VRPDataDescriptor)id;
    5656      var instanceArchiveName = GetResourceName(FileName + @"\.zip");
     
    7676    }
    7777
    78     private static void LoadSolution(Stream stream, VRPData instance) {
     78    private static void LoadSolution(Stream stream, T instance) {
    7979      List<List<int>> routes = new List<List<int>>();
    8080
     
    9999    }
    100100
    101     public static void LoadSolution(string path, VRPData instance) {
     101    public static void LoadSolution(string path, T instance) {
    102102      using (FileStream stream = new FileStream(path, FileMode.Open)) {
    103103        LoadSolution(stream, instance);
     
    105105    }
    106106
    107     protected abstract VRPData LoadData(Stream stream);
     107    protected abstract T LoadData(Stream stream);
    108108
    109109    public IVRPData Import(string vrpFile, string tourFile) {
     
    116116
    117117    public void Export(IVRPData instance, string path) {
    118       ExportData((VRPData)instance, path);
     118      ExportData((T)instance, path);
    119119    }
    120120
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances/3.3/IProblemInstanceConsumer.cs

    r11185 r11289  
    2525  public interface IProblemInstanceConsumer : IContent { }
    2626
    27   public interface IProblemInstanceConsumer<TData> : IProblemInstanceConsumer {
     27  public interface IProblemInstanceConsumer<in TData> : IProblemInstanceConsumer {
    2828    /// <summary>
    2929    /// Loads the given instance data.
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances/3.3/Types/VRP/VRPData.cs

    r11185 r11289  
    2525  /// Describes instances of the Vehicle Routing Problem (VRP).
    2626  /// </summary>
    27   public abstract class VRPData: IVRPData {
     27  public class VRPData : IVRPData {
    2828    /// <summary>
    2929    /// The name of the instance
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.VehicleRouting

  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs

    r11185 r11289  
    4242  [Creatable("Problems")]
    4343  [StorableClass]
    44   public sealed class VehicleRoutingProblem : Problem, ISingleObjectiveHeuristicOptimizationProblem, IStorableContent, IProblemInstanceConsumer<VRPData> {
     44  public sealed class VehicleRoutingProblem : Problem, ISingleObjectiveHeuristicOptimizationProblem, IStorableContent, IProblemInstanceConsumer<IVRPData> {
    4545    public string Filename { get; set; }
    4646
     
    390390    #region IProblemInstanceConsumer<VRPData> Members
    391391
    392     public void Load(VRPData data) {
     392    public void Load(IVRPData data) {
    393393      var interpreterDataType = data.GetType();
    394394      var interpreterType = typeof(IVRPDataInterpreter<>).MakeGenericType(interpreterDataType);
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Tests

  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Tests/HeuristicLab.Problems.VehicleRouting-3.4/VRPInstancesTest.cs

    r11185 r11289  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Linq;
    2425using System.Text;
    25 using HeuristicLab.PluginInfrastructure;
    26 using HeuristicLab.Problems.Instances.VehicleRouting;
     26using HeuristicLab.Problems.Instances;
     27using HeuristicLab.Tests;
    2728using Microsoft.VisualStudio.TestTools.UnitTesting;
    2829
     
    3031  [TestClass]
    3132  public class VRPInstancesTest {
     33    [ClassInitialize]
     34    public static void MyClassInitialize(TestContext testContext) {
     35      PluginLoader.Assemblies.Any();
     36    }
     37
    3238    [TestMethod]
    3339    [TestCategory("Problems.VehicleRouting")]
    3440    [TestProperty("Time", "long")]
    3541    public void TestVRPInstances() {
    36       var providers = ApplicationManager.Manager.GetInstances<VRPInstanceProvider>();
    3742      var vrp = new VehicleRoutingProblem();
     43      var providers = ProblemInstanceManager.GetProviders(vrp);
    3844      var failedInstances = new StringBuilder();
    3945
     
    4147
    4248      foreach (var provider in providers) {
    43         var instances = provider.GetDataDescriptors();
     49        IEnumerable<IDataDescriptor> instances = ((dynamic)provider).GetDataDescriptors();
    4450        Assert.IsTrue(instances.Any(), "No instances could be found.");
    4551
     
    4753          try {
    4854            // throws InvalidOperationException if zero or more than one interpreter is found
    49             vrp.Load(provider.LoadData(instance));
     55            ((dynamic)vrp).Load(((dynamic)provider).LoadData(instance));
    5056          } catch (Exception exc) {
    5157            failedInstances.AppendLine(instance + ": " + exc.Message);
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r11091 r11289  
    330330      <Private>False</Private>
    331331    </Reference>
     332    <Reference Include="Microsoft.CSharp" />
    332333    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
    333334      <Private>false</Private>
Note: See TracChangeset for help on using the changeset viewer.