Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11286


Ignore:
Timestamp:
08/19/14 14:20:34 (10 years ago)
Author:
pfleck
Message:

#2225
Reverted parts of r10435 since the generic VRPInstanceProvider work accordingly after recent changes.

Location:
trunk/sources
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4/VRPInstanceProviderView.cs

    r11171 r11286  
    3737
    3838    protected override void importButton_Click(object sender, EventArgs e) {
    39       var provider = Content as IVRPInstanceProvider;
     39      var provider = Content as IVRPInstanceProvider<T>;
    4040      if (provider != null) {
    4141        using (var dialog = new VRPImportDialog(Content.Name)) {
     
    4343            var instance = provider.Import(dialog.VRPFileName, dialog.TourFileName);
    4444            try {
    45               GenericConsumer.Load(instance as T);
     45              GenericConsumer.Load(instance);
    4646              instancesComboBox.SelectedIndex = -1;
    4747            } catch (Exception ex) {
     
    5454
    5555    protected override void exportButton_Click(object sender, EventArgs e) {
    56       var provider = Content as IVRPInstanceProvider;
     56      var provider = Content as IVRPInstanceProvider<T>;
    5757      if (provider != null) {
    5858        if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/CordeauFormat/CordeauFormatInstanceProvider.cs

    r11171 r11286  
    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    }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/GoldenFormatInstanceProvider.cs

    r11171 r11286  
    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    }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/IVRPInstanceProvider.cs

    r11171 r11286  
    2121
    2222namespace HeuristicLab.Problems.Instances.VehicleRouting {
    23   public interface IVRPInstanceProvider {
     23  public interface IVRPInstanceProvider<T> where T : IVRPData {
    2424    bool CanImportData { get; }
    25     IVRPData Import(string vrpFile, string tourFile);
     25    T Import(string vrpFile, string tourFile);
    2626
    2727    bool CanExportData { get; }
    28     void Export(IVRPData instance, string path);
     28    void Export(T instance, string path);
    2929  }
    3030}
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/LiLimFormat/LiLimFormatInstanceProvider.cs

    r11171 r11286  
    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    }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonFormatInstanceProvider.cs

    r11171 r11286  
    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    }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/TSPLibFormatInstanceProvider.cs

    r11171 r11286  
    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    }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TaillardFormat/TaillardFormatInstanceProvider.cs

    r11171 r11286  
    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    }
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/VRPInstanceProvider.cs

    r11171 r11286  
    2929
    3030namespace HeuristicLab.Problems.Instances.VehicleRouting {
    31   public abstract class VRPInstanceProvider : ProblemInstanceProvider<VRPData>, IVRPInstanceProvider {
     31  public abstract class VRPInstanceProvider<T> : ProblemInstanceProvider<T>, IVRPInstanceProvider<T> 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
    109     public IVRPData Import(string vrpFile, string tourFile) {
     109    public T Import(string vrpFile, string tourFile) {
    110110      var data = ImportData(vrpFile);
    111111      if (!String.IsNullOrEmpty(tourFile)) {
     
    115115    }
    116116
    117     public void Export(IVRPData instance, string path) {
    118       ExportData((VRPData)instance, path);
     117    public void Export(T instance, string path) {
     118      ExportData(instance, path);
    119119    }
    120120
Note: See TracChangeset for help on using the changeset viewer.