- Timestamp:
- 02/13/12 16:35:13 (12 years ago)
- Location:
- branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3
- Property svn:ignore
-
old new 1 1 *.user 2 2 obj 3 Plugin.cs
-
- Property svn:ignore
-
branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBInstance.cs
r7445 r7466 24 24 public string Name { get; set; } 25 25 public string Description { get; set; } 26 public int Dimension { get; set; } 26 27 public double[,] Distances { get; set; } 27 28 public double[,] Weights { get; set; } -
branches/GeneralizedQAP/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBInstanceProvider.cs
r7448 r7466 28 28 29 29 namespace 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 { 34 32 get { return "QAPLIB"; } 35 33 } 36 34 37 public string Description {35 public override string Description { 38 36 get { return "Quadratic Assignment Problem Library"; } 39 37 } 40 38 41 public Uri Link {39 public override Uri Link { 42 40 get { return new Uri("http://www.seas.upenn.edu/qaplib/"); } 43 41 } 44 42 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() { 60 44 var solutions = Assembly.GetExecutingAssembly() 61 45 .GetManifestResourceNames() … … 70 54 } 71 55 72 public IQAPInstance GetInstance(IInstanceDescriptor id) {56 public override IQAPInstance GetInstance(IInstanceDescriptor id) { 73 57 var descriptor = (QAPLIBInstanceDescriptor)id; 74 58 var instance = new QAPLIBInstance(); … … 78 62 datParser.Parse(stream); 79 63 if (datParser.Error != null) throw datParser.Error; 64 instance.Dimension = datParser.Size; 80 65 instance.Distances = datParser.Distances; 81 66 instance.Weights = datParser.Weights;
Note: See TracChangeset
for help on using the changeset viewer.