- Timestamp:
- 07/03/12 13:41:36 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 23 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.CordeauGQAP/3.3/CordeauGQAPInstanceProvider.cs
r8180 r8192 81 81 } 82 82 83 public override GQAPData LoadData(string path) { 83 public override bool CanImportData { 84 get { return true; } 85 } 86 public override GQAPData ImportData(string path) { 84 87 var parser = new CordeauGQAPParser(); 85 88 parser.Parse(path); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs
r8180 r8192 20 20 #endregion 21 21 22 23 22 using System; 24 23 using System.Collections.Generic; 25 24 using System.IO; 25 using System.Linq; 26 26 using System.Text; 27 27 using HeuristicLab.Problems.DataAnalysis; 28 28 29 namespace HeuristicLab.Problems.Instances.DataAnalysis { 29 30 public class ClassificationCSVInstanceProvider : ClassificationInstanceProvider { … … 43 44 } 44 45 45 public override bool CanSaveData {46 get { return true; }47 }48 49 46 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 50 47 return new List<IDataDescriptor>(); 51 48 } 52 49 53 public override void SaveData(IClassificationProblemData instance, string path) { 50 public override IClassificationProblemData LoadData(IDataDescriptor descriptor) { 51 throw new NotImplementedException(); 52 } 53 54 public override bool CanImportData { 55 get { return true; } 56 } 57 public override IClassificationProblemData ImportData(string path) { 58 TableFileParser csvFileParser = new TableFileParser(); 59 60 csvFileParser.Parse(path); 61 62 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 63 string targetVar = csvFileParser.VariableNames.Where(x => dataset.DoubleVariables.Contains(x)).Last(); 64 IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar)); 65 66 ClassificationProblemData claData = new ClassificationProblemData(dataset, allowedInputVars, targetVar); 67 68 int trainingPartEnd = csvFileParser.Rows * 2 / 3; 69 claData.TrainingPartition.Start = 0; 70 claData.TrainingPartition.End = trainingPartEnd; 71 claData.TestPartition.Start = trainingPartEnd; 72 claData.TestPartition.End = csvFileParser.Rows; 73 int pos = path.LastIndexOf('\\'); 74 if (pos < 0) 75 claData.Name = path; 76 else { 77 pos++; 78 claData.Name = path.Substring(pos, path.Length - pos); 79 } 80 81 return claData; 82 } 83 84 public override bool CanExportData { 85 get { return true; } 86 } 87 public override void ExportData(IClassificationProblemData instance, string path) { 54 88 StringBuilder strBuilder = new StringBuilder(); 55 89 … … 74 108 } 75 109 } 76 77 public override IClassificationProblemData LoadData(IDataDescriptor descriptor) {78 throw new NotImplementedException();79 }80 110 } 81 111 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationInstanceProvider.cs
r8180 r8192 20 20 #endregion 21 21 22 using System.Collections;23 using System.Collections.Generic;24 using System.Linq;25 22 using HeuristicLab.Problems.DataAnalysis; 26 23 27 24 namespace HeuristicLab.Problems.Instances.DataAnalysis { 28 25 public abstract class ClassificationInstanceProvider : ProblemInstanceProvider<IClassificationProblemData> { 29 public override IClassificationProblemData LoadData(string path) {30 TableFileParser csvFileParser = new TableFileParser();31 32 csvFileParser.Parse(path);33 34 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);35 string targetVar = csvFileParser.VariableNames.Where(x => dataset.DoubleVariables.Contains(x)).Last();36 IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar));37 38 ClassificationProblemData claData = new ClassificationProblemData(dataset, allowedInputVars, targetVar);39 40 int trainingPartEnd = csvFileParser.Rows * 2 / 3;41 claData.TrainingPartition.Start = 0;42 claData.TrainingPartition.End = trainingPartEnd;43 claData.TestPartition.Start = trainingPartEnd;44 claData.TestPartition.End = csvFileParser.Rows;45 int pos = path.LastIndexOf('\\');46 if (pos < 0)47 claData.Name = path;48 else {49 pos++;50 claData.Name = path.Substring(pos, path.Length - pos);51 }52 53 return claData;54 }55 26 } 56 27 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Clustering/CSV/ClusteringCSVInstanceProvider.cs
r8180 r8192 47 47 } 48 48 49 public override bool CanSaveData { 49 public override IClusteringProblemData LoadData(IDataDescriptor descriptor) { 50 throw new NotImplementedException(); 51 } 52 53 public override bool CanImportData { 50 54 get { return true; } 51 55 } 56 public override IClusteringProblemData ImportData(string path) { 57 var csvFileParser = new TableFileParser(); 52 58 53 public override void SaveData(IClusteringProblemData instance, string path) { 59 csvFileParser.Parse(path); 60 61 var dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 62 var claData = new ClusteringProblemData(dataset, dataset.DoubleVariables); 63 64 int trainingPartEnd = csvFileParser.Rows * 2 / 3; 65 claData.TrainingPartition.Start = 0; 66 claData.TrainingPartition.End = trainingPartEnd; 67 claData.TestPartition.Start = trainingPartEnd; 68 claData.TestPartition.End = csvFileParser.Rows; 69 int pos = path.LastIndexOf('\\'); 70 if (pos < 0) 71 claData.Name = path; 72 else { 73 pos++; 74 claData.Name = path.Substring(pos, path.Length - pos); 75 } 76 77 return claData; 78 } 79 80 public override bool CanExportData { 81 get { return true; } 82 } 83 public override void ExportData(IClusteringProblemData instance, string path) { 54 84 var strBuilder = new StringBuilder(); 55 85 … … 74 104 } 75 105 } 76 77 public override IClusteringProblemData LoadData(IDataDescriptor descriptor) {78 throw new NotImplementedException();79 }80 106 } 81 107 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Clustering/ClusteringInstanceProvider.cs
r8180 r8192 24 24 namespace HeuristicLab.Problems.Instances.DataAnalysis { 25 25 public abstract class ClusteringInstanceProvider : ProblemInstanceProvider<IClusteringProblemData> { 26 public override IClusteringProblemData LoadData(string path) {27 var csvFileParser = new TableFileParser();28 29 csvFileParser.Parse(path);30 31 var dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);32 var claData = new ClusteringProblemData(dataset, dataset.DoubleVariables);33 34 int trainingPartEnd = csvFileParser.Rows * 2 / 3;35 claData.TrainingPartition.Start = 0;36 claData.TrainingPartition.End = trainingPartEnd;37 claData.TestPartition.Start = trainingPartEnd;38 claData.TestPartition.End = csvFileParser.Rows;39 int pos = path.LastIndexOf('\\');40 if (pos < 0)41 claData.Name = path;42 else {43 pos++;44 claData.Name = path.Substring(pos, path.Length - pos);45 }46 47 return claData;48 }49 26 } 50 27 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/CSV/RegressionCSVInstanceProvider.cs
r8180 r8192 20 20 #endregion 21 21 22 23 22 using System; 24 23 using System.Collections.Generic; 25 24 using System.IO; 25 using System.Linq; 26 26 using System.Text; 27 27 using HeuristicLab.Problems.DataAnalysis; 28 28 29 namespace HeuristicLab.Problems.Instances.DataAnalysis { 29 30 public class RegressionCSVInstanceProvider : RegressionInstanceProvider { … … 43 44 } 44 45 45 public override bool CanSaveData {46 get { return true; }47 }48 49 46 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 50 47 return new List<IDataDescriptor>(); 51 48 } 49 public override IRegressionProblemData LoadData(IDataDescriptor descriptor) { 50 throw new NotImplementedException(); 51 } 52 52 53 public override void SaveData(IRegressionProblemData instance, string path) { 53 public override bool CanImportData { 54 get { return true; } 55 } 56 public override IRegressionProblemData ImportData(string path) { 57 TableFileParser csvFileParser = new TableFileParser(); 58 csvFileParser.Parse(path); 59 60 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 61 string targetVar = csvFileParser.VariableNames.Where(x => dataset.DoubleVariables.Contains(x)).Last(); 62 63 IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar)); 64 65 IRegressionProblemData regData = new RegressionProblemData(dataset, allowedInputVars, targetVar); 66 67 int trainingPartEnd = csvFileParser.Rows * 2 / 3; 68 regData.TrainingPartition.Start = 0; 69 regData.TrainingPartition.End = trainingPartEnd; 70 regData.TestPartition.Start = trainingPartEnd; 71 regData.TestPartition.End = csvFileParser.Rows; 72 73 int pos = path.LastIndexOf('\\'); 74 if (pos < 0) 75 regData.Name = path; 76 else { 77 pos++; 78 regData.Name = path.Substring(pos, path.Length - pos); 79 } 80 return regData; 81 } 82 83 public override bool CanExportData { 84 get { return true; } 85 } 86 public override void ExportData(IRegressionProblemData instance, string path) { 54 87 StringBuilder strBuilder = new StringBuilder(); 55 88 … … 74 107 } 75 108 } 76 77 public override IRegressionProblemData LoadData(IDataDescriptor descriptor) {78 throw new NotImplementedException();79 }80 109 } 81 110 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/RegressionInstanceProvider.cs
r8180 r8192 20 20 #endregion 21 21 22 using System.Collections;23 using System.Collections.Generic;24 using System.Linq;25 22 using HeuristicLab.Problems.DataAnalysis; 26 23 27 24 namespace HeuristicLab.Problems.Instances.DataAnalysis { 28 25 public abstract class RegressionInstanceProvider : ProblemInstanceProvider<IRegressionProblemData> { 29 30 public override IRegressionProblemData LoadData(string path) {31 TableFileParser csvFileParser = new TableFileParser();32 csvFileParser.Parse(path);33 34 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);35 string targetVar = csvFileParser.VariableNames.Where(x => dataset.DoubleVariables.Contains(x)).Last();36 37 IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar));38 39 IRegressionProblemData regData = new RegressionProblemData(dataset, allowedInputVars, targetVar);40 41 int trainingPartEnd = csvFileParser.Rows * 2 / 3;42 regData.TrainingPartition.Start = 0;43 regData.TrainingPartition.End = trainingPartEnd;44 regData.TestPartition.Start = trainingPartEnd;45 regData.TestPartition.End = csvFileParser.Rows;46 47 int pos = path.LastIndexOf('\\');48 if (pos < 0)49 regData.Name = path;50 else {51 pos++;52 regData.Name = path.Substring(pos, path.Length - pos);53 }54 return regData;55 }56 26 } 57 27 } -
trunk/sources/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/ElloumiCTAPInstanceProvider.cs
r8180 r8192 103 103 } 104 104 105 public override CTAPData LoadData(string path) { 105 public override bool CanImportData { 106 get { return true; } 107 } 108 public override CTAPData ImportData(string path) { 106 109 var parser = new ElloumiCTAPParser(); 107 110 parser.Parse(path); -
trunk/sources/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBInstanceProvider.cs
r8180 r8192 219 219 } 220 220 221 public override QAPData LoadData(string path) { 221 public override bool CanImportData { 222 get { return true; } 223 } 224 public override QAPData ImportData(string path) { 222 225 var parser = new QAPLIBParser(); 223 226 parser.Parse(path); -
trunk/sources/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBInstanceProvider.cs
r8180 r8192 90 90 } 91 91 92 public override T LoadData(string path) { 92 public override bool CanImportData { 93 get { return true; } 94 } 95 public override T ImportData(string path) { 93 96 return LoadInstance(new TSPLIBParser(path)); 94 97 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4/HeuristicLab.Problems.Instances.VehicleRouting.Views-3.4.csproj
r7923 r8192 115 115 <Compile Include="Plugin.cs" /> 116 116 <Compile Include="Properties\AssemblyInfo.cs" /> 117 <Compile Include="VRPInstance ProviderView.cs">117 <Compile Include="VRPInstanceConsumerView.cs"> 118 118 <SubType>UserControl</SubType> 119 119 </Compile> 120 <Compile Include="VRPInstance ProviderView.designer.cs">121 <DependentUpon>VRPInstance ProviderView.cs</DependentUpon>120 <Compile Include="VRPInstanceConsumerView.designer.cs"> 121 <DependentUpon>VRPInstanceConsumerView.cs</DependentUpon> 122 122 </Compile> 123 123 <Compile Include="VRPImportDialog.cs"> -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4/VRPInstanceConsumerView.cs
r8189 r8192 25 25 using HeuristicLab.MainForm; 26 26 using HeuristicLab.MainForm.WindowsForms; 27 using HeuristicLab.PluginInfrastructure; 27 28 using HeuristicLab.Problems.Instances.Views; 28 29 … … 41 42 } 42 43 44 protected override void SetEnabledStateOfControls() { 45 problemInstanceProviderComboBox.Enabled = !ReadOnly && !Locked && Content != null && problemInstanceProviderComboBox.Items.Count > 0; 46 libraryInfoButton.Enabled = SelectedProvider != null && SelectedProvider.WebLink != null; 47 IVRPInstanceProvider provider = SelectedProvider as IVRPInstanceProvider; 48 importButton.Enabled = !ReadOnly && !Locked && Content != null && Consumer != null && 49 provider != null && provider.CanImportData; 50 ProviderImportSplitContainer.Panel2Collapsed = !importButton.Enabled; 51 exportButton.Enabled = !ReadOnly && !Locked && Content != null && Exporter != null && 52 provider != null && provider.CanExportData; 53 ProviderExportSplitContainer.Panel2Collapsed = !exportButton.Enabled; 54 } 55 43 56 protected override void importButton_Click(object sender, EventArgs e) { 44 57 IVRPInstanceProvider provider = SelectedProvider as IVRPInstanceProvider; … … 46 59 using (var dialog = new VRPImportDialog(SelectedProvider.Name)) { 47 60 if (dialog.ShowDialog() == DialogResult.OK) { 48 var instance = provider. LoadData(dialog.VRPFileName, dialog.TourFileName);61 var instance = provider.Import(dialog.VRPFileName, dialog.TourFileName); 49 62 try { 50 63 GenericConsumer.Load(instance as T); … … 57 70 } 58 71 } 72 73 protected override void exportButton_Click(object sender, EventArgs e) { 74 IVRPInstanceProvider provider = SelectedProvider as IVRPInstanceProvider; 75 if (provider != null) { 76 if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { 77 try { 78 provider.Export(GenericExporter.Export(), saveFileDialog.FileName); 79 } 80 catch (Exception ex) { 81 ErrorHandling.ShowErrorDialog(this, ex); 82 } 83 } 84 } 85 } 59 86 } 60 87 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/CordeauFormat/CordeauFormatInstanceProvider.cs
r7882 r8192 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using System.IO; 25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 using HeuristicLab.Problems.Instances.TSPLIB;30 23 31 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 35 28 } 36 29 37 public override MDCVRPTWData LoadData(string path) { 30 public override bool CanImportData { 31 get { return true; } 32 } 33 public override MDCVRPTWData ImportData(string path) { 38 34 return LoadInstance(new CordeauParser(path)); 39 35 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/GoldenFormatInstanceProvider.cs
r7887 r8192 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.IO; 25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 using HeuristicLab.Problems.Instances.TSPLIB;30 24 31 25 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 35 29 } 36 30 37 public override CVRPTWData LoadData(string path) { 31 public override bool CanImportData { 32 get { return true; } 33 } 34 public override CVRPTWData ImportData(string path) { 38 35 return LoadInstance(new GoldenParser(path)); 39 36 } … … 66 63 } 67 64 68 if (parser.Distance > 0)65 if (parser.Distance > 0) 69 66 instance.DueTimes[0] = parser.Distance; 70 67 -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/IVRPInstanceProvider.cs
r7956 r8192 22 22 namespace HeuristicLab.Problems.Instances.VehicleRouting { 23 23 public interface IVRPInstanceProvider { 24 IVRPData LoadData(string vrpFile, string tourFile); 24 bool CanImportData { get; } 25 IVRPData Import(string vrpFile, string tourFile); 26 27 bool CanExportData { get; } 28 void Export(IVRPData instance, string path); 25 29 } 26 30 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/LiLimFormat/LiLimFormatInstanceProvider.cs
r7882 r8192 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using System.IO; 25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 using HeuristicLab.Problems.Instances.TSPLIB;30 23 31 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 35 28 } 36 29 37 public override PDPTWData LoadData(string path) { 30 public override bool CanImportData { 31 get { return true; } 32 } 33 public override PDPTWData ImportData(string path) { 38 34 return LoadInstance(new LiLimParser(path)); 39 35 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonFormatInstanceProvider.cs
r7882 r8192 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using System.IO; 25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 using HeuristicLab.Problems.Instances.TSPLIB;30 23 31 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 35 28 } 36 29 37 public override CVRPTWData LoadData(string path) { 30 public override bool CanImportData { 31 get { return true; } 32 } 33 public override CVRPTWData ImportData(string path) { 38 34 return LoadInstance(new SolomonParser(path)); 39 35 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/TSPLibFormatInstanceProvider.cs
r7882 r8192 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.IO; 25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 24 using HeuristicLab.Problems.Instances.TSPLIB; 30 25 … … 35 30 } 36 31 37 public override CVRPData LoadData(string path) { 32 public override bool CanImportData { 33 get { return true; } 34 } 35 public override CVRPData ImportData(string path) { 38 36 return LoadInstance(new TSPLIBParser(path)); 39 37 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TaillardFormat/TaillardFormatInstanceProvider.cs
r7888 r8192 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using System.IO; 25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 using HeuristicLab.Problems.Instances.TSPLIB;30 23 31 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 35 28 } 36 29 37 public override CVRPData LoadData(string path) { 30 public override bool CanImportData { 31 get { return true; } 32 } 33 public override CVRPData ImportData(string path) { 38 34 return LoadInstance(new TaillardParser(path)); 39 35 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/VRPInstanceProvider.cs
r8180 r8192 107 107 protected abstract T LoadData(Stream stream); 108 108 109 public IVRPData LoadData(string vrpFile, string tourFile) {110 var data = LoadData(vrpFile);109 public IVRPData Import(string vrpFile, string tourFile) { 110 var data = ImportData(vrpFile); 111 111 if (!String.IsNullOrEmpty(tourFile)) { 112 112 LoadSolution(tourFile, data); 113 113 } 114 114 return data; 115 } 116 117 public void Export(IVRPData instance, string path) { 118 ExportData((T)instance, path); 115 119 } 116 120 -
trunk/sources/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceConsumerViewGeneric.Designer.cs
r7967 r8192 55 55 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 56 56 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); 57 this.problemInstanceProviderSplitContainer = new System.Windows.Forms.SplitContainer(); 58 ((System.ComponentModel.ISupportInitialize)(this.problemInstanceProviderSplitContainer)).BeginInit(); 59 this.problemInstanceProviderSplitContainer.Panel1.SuspendLayout(); 60 this.problemInstanceProviderSplitContainer.Panel2.SuspendLayout(); 61 this.problemInstanceProviderSplitContainer.SuspendLayout(); 57 this.ProviderExportSplitContainer = new System.Windows.Forms.SplitContainer(); 58 this.ProviderImportSplitContainer = new System.Windows.Forms.SplitContainer(); 59 ((System.ComponentModel.ISupportInitialize)(this.ProviderExportSplitContainer)).BeginInit(); 60 this.ProviderExportSplitContainer.Panel1.SuspendLayout(); 61 this.ProviderExportSplitContainer.Panel2.SuspendLayout(); 62 this.ProviderExportSplitContainer.SuspendLayout(); 63 ((System.ComponentModel.ISupportInitialize)(this.ProviderImportSplitContainer)).BeginInit(); 64 this.ProviderImportSplitContainer.Panel1.SuspendLayout(); 65 this.ProviderImportSplitContainer.Panel2.SuspendLayout(); 66 this.ProviderImportSplitContainer.SuspendLayout(); 62 67 this.SuspendLayout(); 63 68 // 64 69 // problemInstanceProviderComboBox 65 70 // 66 this.problemInstanceProviderComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 67 | System.Windows.Forms.AnchorStyles.Right)));71 this.problemInstanceProviderComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 72 | System.Windows.Forms.AnchorStyles.Right))); 68 73 this.problemInstanceProviderComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 69 74 this.problemInstanceProviderComboBox.FormattingEnabled = true; 70 75 this.problemInstanceProviderComboBox.Location = new System.Drawing.Point(50, 1); 71 76 this.problemInstanceProviderComboBox.Name = "problemInstanceProviderComboBox"; 72 this.problemInstanceProviderComboBox.Size = new System.Drawing.Size(17 1, 21);77 this.problemInstanceProviderComboBox.Size = new System.Drawing.Size(174, 21); 73 78 this.problemInstanceProviderComboBox.TabIndex = 16; 74 79 this.problemInstanceProviderComboBox.SelectedIndexChanged += new System.EventHandler(this.problemInstanceProviderComboBox_SelectedIndexChanged); … … 77 82 // 78 83 this.libraryInfoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 79 this.libraryInfoButton.Location = new System.Drawing.Point(2 27, -1);84 this.libraryInfoButton.Location = new System.Drawing.Point(230, -1); 80 85 this.libraryInfoButton.Name = "libraryInfoButton"; 81 86 this.libraryInfoButton.Size = new System.Drawing.Size(24, 24); … … 88 93 // 89 94 this.libraryLabel.AutoSize = true; 90 this.libraryLabel.Location = new System.Drawing.Point( 4, 4);95 this.libraryLabel.Location = new System.Drawing.Point(3, 5); 91 96 this.libraryLabel.Name = "libraryLabel"; 92 97 this.libraryLabel.Size = new System.Drawing.Size(41, 13); … … 96 101 // problemInstanceProviderViewHost 97 102 // 98 this.problemInstanceProviderViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 99 | System.Windows.Forms.AnchorStyles.Right)));103 this.problemInstanceProviderViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 104 | System.Windows.Forms.AnchorStyles.Right))); 100 105 this.problemInstanceProviderViewHost.Caption = "View"; 101 106 this.problemInstanceProviderViewHost.Content = null; … … 112 117 // 113 118 this.importButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 114 this.importButton.Location = new System.Drawing.Point( 257, -1);119 this.importButton.Location = new System.Drawing.Point(1, -1); 115 120 this.importButton.Name = "importButton"; 116 121 this.importButton.Size = new System.Drawing.Size(24, 24); … … 140 145 this.saveFileDialog.Title = "Save RegressionInstance..."; 141 146 // 142 // problemInstanceProviderSplitContainer 143 // 144 this.problemInstanceProviderSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; 145 this.problemInstanceProviderSplitContainer.IsSplitterFixed = true; 146 this.problemInstanceProviderSplitContainer.Location = new System.Drawing.Point(0, 0); 147 this.problemInstanceProviderSplitContainer.Name = "problemInstanceProviderSplitContainer"; 148 // 149 // problemInstanceProviderSplitContainer.Panel1 150 // 151 this.problemInstanceProviderSplitContainer.Panel1.Controls.Add(this.problemInstanceProviderComboBox); 152 this.problemInstanceProviderSplitContainer.Panel1.Controls.Add(this.importButton); 153 this.problemInstanceProviderSplitContainer.Panel1.Controls.Add(this.libraryLabel); 154 this.problemInstanceProviderSplitContainer.Panel1.Controls.Add(this.libraryInfoButton); 155 // 156 // problemInstanceProviderSplitContainer.Panel2 157 // 158 this.problemInstanceProviderSplitContainer.Panel2.Controls.Add(this.exportButton); 159 this.problemInstanceProviderSplitContainer.Size = new System.Drawing.Size(312, 22); 160 this.problemInstanceProviderSplitContainer.SplitterDistance = 280; 161 this.problemInstanceProviderSplitContainer.TabIndex = 20; 147 // ProviderExportSplitContainer 148 // 149 this.ProviderExportSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; 150 this.ProviderExportSplitContainer.IsSplitterFixed = true; 151 this.ProviderExportSplitContainer.Location = new System.Drawing.Point(0, 0); 152 this.ProviderExportSplitContainer.Name = "ProviderExportSplitContainer"; 153 // 154 // ProviderExportSplitContainer.Panel1 155 // 156 this.ProviderExportSplitContainer.Panel1.Controls.Add(this.ProviderImportSplitContainer); 157 // 158 // ProviderExportSplitContainer.Panel2 159 // 160 this.ProviderExportSplitContainer.Panel2.Controls.Add(this.exportButton); 161 this.ProviderExportSplitContainer.Size = new System.Drawing.Size(312, 22); 162 this.ProviderExportSplitContainer.SplitterDistance = 283; 163 this.ProviderExportSplitContainer.TabIndex = 20; 164 // 165 // ProviderImportSplitContainer 166 // 167 this.ProviderImportSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 168 | System.Windows.Forms.AnchorStyles.Right))); 169 this.ProviderImportSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; 170 this.ProviderImportSplitContainer.IsSplitterFixed = true; 171 this.ProviderImportSplitContainer.Location = new System.Drawing.Point(0, 0); 172 this.ProviderImportSplitContainer.Name = "ProviderImportSplitContainer"; 173 // 174 // ProviderImportSplitContainer.Panel1 175 // 176 this.ProviderImportSplitContainer.Panel1.Controls.Add(this.libraryLabel); 177 this.ProviderImportSplitContainer.Panel1.Controls.Add(this.problemInstanceProviderComboBox); 178 this.ProviderImportSplitContainer.Panel1.Controls.Add(this.libraryInfoButton); 179 // 180 // ProviderImportSplitContainer.Panel2 181 // 182 this.ProviderImportSplitContainer.Panel2.Controls.Add(this.importButton); 183 this.ProviderImportSplitContainer.Size = new System.Drawing.Size(282, 23); 184 this.ProviderImportSplitContainer.SplitterDistance = 253; 185 this.ProviderImportSplitContainer.TabIndex = 21; 162 186 // 163 187 // ProblemInstanceConsumerViewGeneric 164 188 // 165 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);166 189 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 167 this.Controls.Add(this. problemInstanceProviderSplitContainer);190 this.Controls.Add(this.ProviderExportSplitContainer); 168 191 this.Controls.Add(this.problemInstanceProviderViewHost); 169 192 this.Name = "ProblemInstanceConsumerViewGeneric"; 170 this.problemInstanceProviderSplitContainer.Panel1.ResumeLayout(false); 171 this.problemInstanceProviderSplitContainer.Panel1.PerformLayout(); 172 this.problemInstanceProviderSplitContainer.Panel2.ResumeLayout(false); 173 ((System.ComponentModel.ISupportInitialize)(this.problemInstanceProviderSplitContainer)).EndInit(); 174 this.problemInstanceProviderSplitContainer.ResumeLayout(false); 193 this.ProviderExportSplitContainer.Panel1.ResumeLayout(false); 194 this.ProviderExportSplitContainer.Panel2.ResumeLayout(false); 195 ((System.ComponentModel.ISupportInitialize)(this.ProviderExportSplitContainer)).EndInit(); 196 this.ProviderExportSplitContainer.ResumeLayout(false); 197 this.ProviderImportSplitContainer.Panel1.ResumeLayout(false); 198 this.ProviderImportSplitContainer.Panel1.PerformLayout(); 199 this.ProviderImportSplitContainer.Panel2.ResumeLayout(false); 200 ((System.ComponentModel.ISupportInitialize)(this.ProviderImportSplitContainer)).EndInit(); 201 this.ProviderImportSplitContainer.ResumeLayout(false); 175 202 this.ResumeLayout(false); 176 203 … … 180 207 181 208 protected System.Windows.Forms.ComboBox problemInstanceProviderComboBox; 182 pr ivateSystem.Windows.Forms.Button libraryInfoButton;183 pr ivateSystem.Windows.Forms.Label libraryLabel;209 protected System.Windows.Forms.Button libraryInfoButton; 210 protected System.Windows.Forms.Label libraryLabel; 184 211 protected MainForm.WindowsForms.ViewHost problemInstanceProviderViewHost; 185 pr ivateSystem.Windows.Forms.ToolTip toolTip;186 pr ivateSystem.Windows.Forms.Button importButton;187 pr ivateSystem.Windows.Forms.Button exportButton;212 protected System.Windows.Forms.ToolTip toolTip; 213 protected System.Windows.Forms.Button importButton; 214 protected System.Windows.Forms.Button exportButton; 188 215 protected System.Windows.Forms.SaveFileDialog saveFileDialog; 189 216 protected System.Windows.Forms.OpenFileDialog openFileDialog; 190 private System.Windows.Forms.SplitContainer problemInstanceProviderSplitContainer; 217 protected System.Windows.Forms.SplitContainer ProviderExportSplitContainer; 218 protected System.Windows.Forms.SplitContainer ProviderImportSplitContainer; 191 219 } 192 220 } -
trunk/sources/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceConsumerViewGeneric.cs
r8180 r8192 92 92 problemInstanceProviderComboBox.Enabled = !ReadOnly && !Locked && Content != null && problemInstanceProviderComboBox.Items.Count > 0; 93 93 libraryInfoButton.Enabled = SelectedProvider != null && SelectedProvider.WebLink != null; 94 importButton.Enabled = !ReadOnly && !Locked && Content != null && Consumer != null; 94 importButton.Enabled = !ReadOnly && !Locked && Content != null && Consumer != null && 95 GenericSelectedProvider != null && GenericSelectedProvider.CanImportData; 96 ProviderImportSplitContainer.Panel2Collapsed = !importButton.Enabled; 95 97 exportButton.Enabled = !ReadOnly && !Locked && Content != null && Exporter != null && 96 GenericSelectedProvider != null && GenericSelectedProvider.Can SaveData;97 problemInstanceProviderSplitContainer.Panel2Collapsed = !exportButton.Enabled;98 GenericSelectedProvider != null && GenericSelectedProvider.CanExportData; 99 ProviderExportSplitContainer.Panel2Collapsed = !exportButton.Enabled; 98 100 } 99 101 … … 132 134 T instance = default(T); 133 135 try { 134 instance = GenericSelectedProvider. LoadData(openFileDialog.FileName);136 instance = GenericSelectedProvider.ImportData(openFileDialog.FileName); 135 137 } 136 138 catch (Exception ex) { … … 147 149 } 148 150 149 protected v oid exportButton_Click(object sender, EventArgs e) {151 protected virtual void exportButton_Click(object sender, EventArgs e) { 150 152 if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { 151 153 try { 152 GenericSelectedProvider. SaveData(GenericExporter.Export(), saveFileDialog.FileName);154 GenericSelectedProvider.ExportData(GenericExporter.Export(), saveFileDialog.FileName); 153 155 } 154 156 catch (Exception ex) { -
trunk/sources/HeuristicLab.Problems.Instances/3.3/IProblemInstanceProvider.cs
r8180 r8192 35 35 IEnumerable<IDataDescriptor> GetDataDescriptors(); 36 36 TData LoadData(IDataDescriptor descriptor); 37 TData LoadData(string path);38 37 39 bool CanSaveData { get; } 40 void SaveData(TData instance, string path); 38 bool CanImportData { get; } 39 TData ImportData(string path); 40 41 bool CanExportData { get; } 42 void ExportData(TData instance, string path); 41 43 } 42 44 } -
trunk/sources/HeuristicLab.Problems.Instances/3.3/ProblemInstanceProvider.cs
r8180 r8192 33 33 34 34 public abstract TData LoadData(IDataDescriptor descriptor); 35 public abstract TData LoadData(string path);36 35 37 public virtual bool Can SaveData {36 public virtual bool CanImportData { 38 37 get { return false; } 39 38 } 40 public virtual void SaveData(TData instance, string path) { 39 public virtual TData ImportData(string path) { 40 throw new NotSupportedException(); 41 } 42 43 public virtual bool CanExportData { 44 get { return false; } 45 } 46 public virtual void ExportData(TData instance, string path) { 41 47 throw new NotSupportedException(); 42 48 }
Note: See TracChangeset
for help on using the changeset viewer.