Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/15/12 17:28:37 (13 years ago)
Author:
abeham
Message:

#1614

  • Removed incompatible problem linhp318.tsp (contains fixed edges)
  • Fixed AssemblyInfo for TSPLIB
  • Added unit tests
  • Worked on assignment / solution view
Location:
branches/GeneralizedQAP
Files:
3 added
2 deleted
14 edited

Legend:

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

    r7438 r7470  
    5656      this.label3 = new System.Windows.Forms.Label();
    5757      this.flowDistanceQualityLabel = new System.Windows.Forms.Label();
     58      this.assignmentSplitContainer = new System.Windows.Forms.SplitContainer();
     59      this.assignmentView = new HeuristicLab.Data.Views.StringConvertibleArrayView();
    5860      this.assignmentGroupBox.SuspendLayout();
    5961      this.characteristicsGroupBox.SuspendLayout();
     62      ((System.ComponentModel.ISupportInitialize)(this.assignmentSplitContainer)).BeginInit();
     63      this.assignmentSplitContainer.Panel1.SuspendLayout();
     64      this.assignmentSplitContainer.Panel2.SuspendLayout();
     65      this.assignmentSplitContainer.SuspendLayout();
    6066      this.SuspendLayout();
    6167      //
    6268      // assignmentTreeView
    6369      //
    64       this.assignmentTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    65                   | System.Windows.Forms.AnchorStyles.Left)
    66                   | System.Windows.Forms.AnchorStyles.Right)));
    67       this.assignmentTreeView.Location = new System.Drawing.Point(6, 19);
     70      this.assignmentTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
     71      this.assignmentTreeView.Location = new System.Drawing.Point(0, 0);
    6872      this.assignmentTreeView.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3);
    6973      this.assignmentTreeView.Name = "assignmentTreeView";
    70       this.assignmentTreeView.Size = new System.Drawing.Size(228, 331);
     74      this.assignmentTreeView.Size = new System.Drawing.Size(78, 337);
    7175      this.assignmentTreeView.TabIndex = 3;
    7276      this.assignmentTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.assignmentTreeView_AfterSelect);
     
    9599      // assignmentGroupBox
    96100      //
    97       this.assignmentGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    98                   | System.Windows.Forms.AnchorStyles.Left)
    99                   | System.Windows.Forms.AnchorStyles.Right)));
    100       this.assignmentGroupBox.Controls.Add(this.assignmentTreeView);
     101      this.assignmentGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     102            | System.Windows.Forms.AnchorStyles.Left)
     103            | System.Windows.Forms.AnchorStyles.Right)));
     104      this.assignmentGroupBox.Controls.Add(this.assignmentSplitContainer);
    101105      this.assignmentGroupBox.Location = new System.Drawing.Point(217, 3);
    102106      this.assignmentGroupBox.Name = "assignmentGroupBox";
     
    108112      // characteristicsGroupBox
    109113      //
    110       this.characteristicsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    111                   | System.Windows.Forms.AnchorStyles.Left)));
     114      this.characteristicsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     115            | System.Windows.Forms.AnchorStyles.Left)));
    112116      this.characteristicsGroupBox.Controls.Add(this.label7);
    113117      this.characteristicsGroupBox.Controls.Add(this.overbookedCapacityLabel);
     
    185189      this.flowDistanceQualityLabel.Text = "-";
    186190      //
     191      // assignmentSplitContainer
     192      //
     193      this.assignmentSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
     194      this.assignmentSplitContainer.Location = new System.Drawing.Point(3, 16);
     195      this.assignmentSplitContainer.Name = "assignmentSplitContainer";
     196      //
     197      // assignmentSplitContainer.Panel1
     198      //
     199      this.assignmentSplitContainer.Panel1.Controls.Add(this.assignmentTreeView);
     200      //
     201      // assignmentSplitContainer.Panel2
     202      //
     203      this.assignmentSplitContainer.Panel2.Controls.Add(this.assignmentView);
     204      this.assignmentSplitContainer.Size = new System.Drawing.Size(234, 337);
     205      this.assignmentSplitContainer.SplitterDistance = 78;
     206      this.assignmentSplitContainer.TabIndex = 4;
     207      //
     208      // assignmentView
     209      //
     210      this.assignmentView.Caption = "StringConvertibleArray View";
     211      this.assignmentView.Content = null;
     212      this.assignmentView.Dock = System.Windows.Forms.DockStyle.Fill;
     213      this.assignmentView.Location = new System.Drawing.Point(0, 0);
     214      this.assignmentView.Name = "assignmentView";
     215      this.assignmentView.ReadOnly = false;
     216      this.assignmentView.Size = new System.Drawing.Size(152, 337);
     217      this.assignmentView.TabIndex = 0;
     218      //
    187219      // GQAPAssignmentView
    188220      //
     
    196228      this.characteristicsGroupBox.ResumeLayout(false);
    197229      this.characteristicsGroupBox.PerformLayout();
     230      this.assignmentSplitContainer.Panel1.ResumeLayout(false);
     231      this.assignmentSplitContainer.Panel2.ResumeLayout(false);
     232      ((System.ComponentModel.ISupportInitialize)(this.assignmentSplitContainer)).EndInit();
     233      this.assignmentSplitContainer.ResumeLayout(false);
    198234      this.ResumeLayout(false);
    199235
     
    213249    private System.Windows.Forms.Label label5;
    214250    private System.Windows.Forms.Label installationQualityLabel;
     251    private System.Windows.Forms.SplitContainer assignmentSplitContainer;
     252    private Data.Views.StringConvertibleArrayView assignmentView;
    215253  }
    216254}
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.cs

    r7448 r7470  
    4949    protected override void DeregisterContentEvents() {
    5050      Content.PropertyChanged -= new PropertyChangedEventHandler(Content_PropertyChanged);
    51       Content.Solution.PropertyChanged -= new PropertyChangedEventHandler(ContentSolution_PropertyChanged);
    5251      base.DeregisterContentEvents();
    5352    }
     
    5554      base.RegisterContentEvents();
    5655      Content.PropertyChanged += new PropertyChangedEventHandler(Content_PropertyChanged);
    57       Content.Solution.PropertyChanged += new PropertyChangedEventHandler(ContentSolution_PropertyChanged);
    5856    }
    5957    #endregion
     
    7573    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    7674      switch (e.PropertyName) {
    77         case "EquipmentNames": UpdateAssignment(); break;
    78         case "LocationNames": UpdateAssignment(); break;
    79         default: break;
    80       }
    81     }
    82     private void ContentSolution_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    83       switch (e.PropertyName) {
    8475        case "Quality": UpdateQuality(); break;
    8576        case "FlowDistanceQuality": UpdateFlowDistanceQuality(); break;
     
    8778        case "OverbookedCapacity": UpdateOverbookedCapacity(); break;
    8879        case "Assignment": UpdateAssignment(); break;
     80        case "EquipmentNames": UpdateAssignment(); break;
     81        case "LocationNames": UpdateAssignment(); break;
    8982        default: break;
    9083      }
     84    }
     85
     86    private void Content_Assignment_ToStringChanged(object sender, EventArgs e) {
     87      UpdateAssignment();
    9188    }
    9289    #endregion
     
    129126          qualityLabel.Text = "-";
    130127        } else {
    131           qualityLabel.Text = Content.Solution.Quality.ToString();
     128          qualityLabel.Text = Content.Quality.ToString();
    132129        }
    133130      }
     
    137134      if (InvokeRequired) Invoke((Action)UpdateFlowDistanceQuality);
    138135      else {
    139         if (Content == null || Content.Solution.FlowDistanceQuality == null) {
     136        if (Content == null || Content.FlowDistanceQuality == null) {
    140137          flowDistanceQualityLabel.Text = "-";
    141138        } else {
    142           flowDistanceQualityLabel.Text = Content.Solution.FlowDistanceQuality.ToString();
     139          flowDistanceQualityLabel.Text = Content.FlowDistanceQuality.ToString();
    143140        }
    144141      }
     
    148145      if (InvokeRequired) Invoke((Action)UpdateInstallationQuality);
    149146      else {
    150         if (Content == null || Content.Solution.InstallationQuality == null) {
     147        if (Content == null || Content.InstallationQuality == null) {
    151148          installationQualityLabel.Text = "-";
    152149        } else {
    153           installationQualityLabel.Text = Content.Solution.InstallationQuality.ToString();
     150          installationQualityLabel.Text = Content.InstallationQuality.ToString();
    154151        }
    155152      }
     
    159156      if (InvokeRequired) Invoke((Action)UpdateOverbookedCapacity);
    160157      else {
    161         if (Content == null || Content.Solution.OverbookedCapacity == null) {
     158        if (Content == null || Content.OverbookedCapacity == null) {
    162159          overbookedCapacityLabel.Text = "-";
    163160        } else {
    164           overbookedCapacityLabel.Text = Content.Solution.OverbookedCapacity.ToString();
     161          overbookedCapacityLabel.Text = Content.OverbookedCapacity.ToString();
    165162        }
    166163      }
     
    172169        assignmentTreeView.Nodes.Clear();
    173170        if (Content != null) {
    174           IntegerVector assignment = Content.Solution.Assignment;
     171          IntegerVector assignment = Content.Assignment;
    175172          Dictionary<int, TreeNode> locationNodes = new Dictionary<int, TreeNode>();
    176173          for (int i = 0; i < assignment.Length; i++) {
     
    202199      var installationCosts = new Dictionary<EquipmentNode, double>();
    203200      foreach (var node in GetAllSubNodes(assignmentTreeView.Nodes).OfType<EquipmentNode>()) {
    204         int location = Content.Solution.Assignment[node.Equipment];
     201        int location = Content.Assignment[node.Equipment];
    205202        installationCosts[node] = Content.InstallationCosts[node.Equipment, location];
    206203      }
     
    249246
    250247    private void ColorByWeight(LocationNode selectedNode) {
    251       var equipments = new HashSet<int>(Content.Solution.Assignment.Select((v, i) => new { Index = i, Value = v })
     248      var equipments = new HashSet<int>(Content.Assignment.Select((v, i) => new { Index = i, Value = v })
    252249        .Where(x => x.Value == selectedNode.Location).Select(x => x.Index));
    253250      var rowSums = new Dictionary<int, double>(equipments.Count);
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3.csproj

    r7448 r7470  
    5454      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
    5555    </Reference>
     56    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    5657    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3">
    5758      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.IntegerVectorEncoding-3.3.dll</HintPath>
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ProblemInstanceProviderView.cs

    r7466 r7470  
    6060      var instance = (IInstanceDescriptor)instancesComboBox.SelectedItem;
    6161      if (!Content.FeedConsumer(instance)) {
    62         MessageBox.Show("Loading the problem instance " + instance.Name + " failed.");
     62        MessageBox.Show("This problem does not support the instance " + instance.Name + ".", "Cannot load instance");
    6363      }
    6464    }
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers/BestGQAPSolutionAnalyzer.cs

    r7444 r7470  
    4141    IDemandsAwareGQAPOperator, ICapacitiesAwareGQAPOperator, ITransportationCostsAwareGQAPOperator,
    4242    IOverbookedCapacityPenaltyAwareGQAPOperator, IEquipmentNamesAwareGQAPOperator, ILocationNamesAwareGQAPOperator,
    43     IBestKnownQualityAwareGQAPOperator, IBestKnownSolutionAwareGQAPOperator, IBestKnownSolutionsAwareGQAPOperator,
    44     IAnalyzer {
     43    IBestKnownQualityAwareGQAPOperator, IBestKnownSolutionAwareGQAPOperator, IAnalyzer {
    4544
    4645    public bool EnabledByDefault {
     
    9796      get { return (ILookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
    9897    }
    99     public ILookupParameter<GQAPSolution> BestKnownSolutionParameter {
    100       get { return (ILookupParameter<GQAPSolution>)Parameters["BestKnownSolution"]; }
    101     }
    102     public ILookupParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter {
    103       get { return (ILookupParameter<GQAPAssignmentArchive>)Parameters["BestKnownSolutions"]; }
     98    public ILookupParameter<GQAPAssignment> BestKnownSolutionParameter {
     99      get { return (ILookupParameter<GQAPAssignment>)Parameters["BestKnownSolution"]; }
    104100    }
    105101    public ILookupParameter<GQAPAssignment> BestSolutionParameter {
     
    135131      Parameters.Add(new LookupParameter<StringArray>("LocationNames", GeneralizedQuadraticAssignmentProblem.LocationNamesDescription));
    136132      Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", GeneralizedQuadraticAssignmentProblem.BestKnownQualityDescription));
    137       Parameters.Add(new LookupParameter<GQAPSolution>("BestKnownSolution", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionDescription));
    138       Parameters.Add(new LookupParameter<GQAPAssignmentArchive>("BestKnownSolutions", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionsDescription));
     133      Parameters.Add(new LookupParameter<GQAPAssignment>("BestKnownSolution", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionDescription));
    139134      Parameters.Add(new LookupParameter<GQAPAssignment>("BestSolution", "The best GQAP solution found so far."));
    140135      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best GQAP solution should be stored."));
     
    159154      var maximization = MaximizationParameter.ActualValue.Value;
    160155      var bestKnownQuality = BestKnownQualityParameter.ActualValue;
    161       var bestKnownSolutions = BestKnownSolutionsParameter.ActualValue;
    162156
    163157      int bestIndex;
     
    168162      if (bestKnownQuality == null || HasSolutionImproved(bestKnownQuality.Value, qualities[bestIndex].Value, maximization)) {
    169163        BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[bestIndex].Value);
    170         BestKnownSolutionParameter.ActualValue = new GQAPSolution((IntegerVector)assignments[bestIndex].Clone(), qualities[bestIndex], flowDistanceQualities[bestIndex], installationQualities[bestIndex], overbookedCapacities[bestIndex]);
     164        BestKnownSolutionParameter.ActualValue = new GQAPAssignment((IntegerVector)assignments[bestIndex].Clone(), (DoubleValue)qualities[bestIndex].Clone(), flowDistanceQualities[bestIndex], installationQualities[bestIndex], overbookedCapacities[bestIndex], equipmentNames, locationNames, distances, weights, installationCosts, demands, capacities, transportationCosts, overbookedCapacityPenalty);
    171165      }
    172166
    173       GQAPAssignment assignment = BestSolutionParameter.ActualValue;
     167      var assignment = BestSolutionParameter.ActualValue;
    174168      if (assignment == null) {
    175169        assignment = new GQAPAssignment((IntegerVector)assignments[bestIndex].Clone(), (DoubleValue)qualities[bestIndex].Clone(), flowDistanceQualities[bestIndex], installationQualities[bestIndex], overbookedCapacities[bestIndex], equipmentNames, locationNames, distances, weights, installationCosts, demands, capacities, transportationCosts, overbookedCapacityPenalty);
    176170        assignment.Distances = distances;
    177171        BestSolutionParameter.ActualValue = assignment;
    178         results.Add(new Result("Best GQAP Solution", assignment));
    179172      } else {
    180         if (HasSolutionImproved(assignment.Solution.Quality.Value, qualities[bestIndex].Value, maximization)) {
    181           assignment.Solution = new GQAPSolution((IntegerVector)assignments[bestIndex].Clone(),
    182             (DoubleValue)qualities[bestIndex].Clone(), (DoubleValue)flowDistanceQualities[bestIndex].Clone(),
    183             (DoubleValue)installationQualities[bestIndex].Clone(), (DoubleValue)overbookedCapacities[bestIndex].Clone());
     173        if (HasSolutionImproved(assignment.Quality.Value, qualities[bestIndex].Value, maximization)) {
     174          assignment.Assignment = (IntegerVector)assignments[bestIndex].Clone();
     175          assignment.Quality = (DoubleValue)qualities[bestIndex].Clone();
     176          assignment.FlowDistanceQuality = (DoubleValue)flowDistanceQualities[bestIndex].Clone();
     177          assignment.InstallationQuality = (DoubleValue)installationQualities[bestIndex].Clone();
     178          assignment.OverbookedCapacity = (DoubleValue)overbookedCapacities[bestIndex].Clone();
    184179          assignment.EquipmentNames = equipmentNames;
    185180          assignment.LocationNames = locationNames;
     
    193188        }
    194189      }
    195 
    196       GQAPAssignmentArchive archive = BestKnownSolutionsParameter.ActualValue;
    197       if (archive == null) {
    198         archive = new GQAPAssignmentArchive(equipmentNames, locationNames, distances, weights, installationCosts, demands, capacities, transportationCosts, overbookedCapacityPenalty);
    199         BestKnownSolutionsParameter.ActualValue = archive;
    200       } else {
    201         var solutions = Enumerable.Range(0, assignments.Length)
    202         .Select(i => new GQAPSolution(assignments[i], qualities[i], flowDistanceQualities[i], installationQualities[i], overbookedCapacities[i]))
    203         .Concat(archive.Solutions);
    204         archive.Solutions = GQAPSolutionArchiveUpdater.GetFeasibleParetoFront(solutions);
    205       }
     190      if (!results.ContainsKey("Best GQAP Assignment"))
     191        results.Add(new Result("Best GQAP Assignment", assignment));
    206192
    207193      return base.Apply();
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers/GQAPSolutionArchiveAnalyzer.cs

    r7444 r7470  
    4040    IDemandsAwareGQAPOperator, ICapacitiesAwareGQAPOperator, ITransportationCostsAwareGQAPOperator,
    4141    IOverbookedCapacityPenaltyAwareGQAPOperator, IEquipmentNamesAwareGQAPOperator, ILocationNamesAwareGQAPOperator,
    42     IAnalyzer {
     42    IBestKnownSolutionsAwareGQAPOperator, IAnalyzer {
    4343
    4444    public bool EnabledByDefault {
    45       get { return false; }
     45      get { return true; }
    4646    }
    4747
     
    9494      get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
    9595    }
     96    public ILookupParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter {
     97      get { return (ILookupParameter<GQAPAssignmentArchive>)Parameters["BestKnownSolutions"]; }
     98    }
    9699
    97100    [StorableConstructor]
     
    119122      Parameters.Add(new LookupParameter<StringArray>("LocationNames", GeneralizedQuadraticAssignmentProblem.LocationNamesDescription));
    120123      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best GQAP solution should be stored."));
     124      Parameters.Add(new LookupParameter<GQAPAssignmentArchive>("BestKnownSolutions", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionsDescription));
    121125    }
    122126
     
    160164      archive.Solutions = GQAPSolutionArchiveUpdater.GetFeasibleParetoFront(solutions);
    161165
     166      GQAPAssignmentArchive bestKnownArchive = BestKnownSolutionsParameter.ActualValue;
     167      if (bestKnownArchive == null) {
     168        bestKnownArchive = new GQAPAssignmentArchive();
     169        BestKnownSolutionsParameter.ActualValue = bestKnownArchive;
     170      } else {
     171        var archiveSolutions = Enumerable.Range(0, assignments.Length)
     172        .Select(i => new GQAPSolution(assignments[i], qualities[i], flowDistanceQualities[i], installationQualities[i], overbookedCapacities[i]))
     173        .Concat(archive.Solutions);
     174        bestKnownArchive.Solutions = GQAPSolutionArchiveUpdater.GetFeasibleParetoFront(archiveSolutions);
     175      }
     176
    162177      return base.Apply();
    163178    }
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GQAPAssignment.cs

    r7437 r7470  
    3333
    3434    [Storable]
    35     private GQAPSolution solution;
    36     public GQAPSolution Solution {
    37       get { return solution; }
    38       set {
    39         bool changed = (solution != value);
    40         solution = value;
    41         if (changed) OnPropertyChanged("Solution");
     35    private IntegerVector assignment;
     36    public IntegerVector Assignment {
     37      get { return assignment; }
     38      set {
     39        bool changed = (assignment != value);
     40        assignment = value;
     41        if (changed) OnPropertyChanged("Assignment");
     42      }
     43    }
     44
     45    [Storable]
     46    private DoubleValue quality;
     47    public DoubleValue Quality {
     48      get { return quality; }
     49      set {
     50        bool changed = (quality != value);
     51        quality = value;
     52        if (changed) OnPropertyChanged("Quality");
     53      }
     54    }
     55
     56    [Storable]
     57    private DoubleValue flowDistanceQuality;
     58    public DoubleValue FlowDistanceQuality {
     59      get { return flowDistanceQuality; }
     60      set {
     61        bool changed = (flowDistanceQuality != value);
     62        flowDistanceQuality = value;
     63        if (changed) OnPropertyChanged("FlowDistanceQuality");
     64      }
     65    }
     66
     67    [Storable]
     68    private DoubleValue installationQuality;
     69    public DoubleValue InstallationQuality {
     70      get { return installationQuality; }
     71      set {
     72        bool changed = (installationQuality != value);
     73        installationQuality = value;
     74        if (changed) OnPropertyChanged("InstallationQuality");
     75      }
     76    }
     77
     78    [Storable]
     79    private DoubleValue overbookedCapacity;
     80    public DoubleValue OverbookedCapacity {
     81      get { return overbookedCapacity; }
     82      set {
     83        bool changed = (overbookedCapacity != value);
     84        overbookedCapacity = value;
     85        if (changed) OnPropertyChanged("OverbookedCapacity");
    4286      }
    4387    }
     
    146190    private GQAPAssignment(GQAPAssignment original, Cloner cloner)
    147191      : base(original, cloner) {
     192      assignment = cloner.Clone(original.assignment);
     193      quality = cloner.Clone(original.quality);
     194      flowDistanceQuality = cloner.Clone(original.flowDistanceQuality);
     195      installationQuality = cloner.Clone(original.installationQuality);
     196      overbookedCapacity = cloner.Clone(original.overbookedCapacity);
    148197      equipmentNames = cloner.Clone(original.equipmentNames);
    149198      locationNames = cloner.Clone(original.locationNames);
     
    156205      overbookedCapacityPenalty = cloner.Clone(original.overbookedCapacityPenalty);
    157206    }
    158     public GQAPAssignment(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity)
     207    public GQAPAssignment(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity, StringArray equipmentNames, StringArray locationNames, DoubleMatrix distances, DoubleMatrix weights, DoubleMatrix installationCosts, DoubleArray demands, DoubleArray capacities, DoubleValue transportationCosts, DoubleValue overbookedCapacityPenalty)
    159208      : base() {
    160       this.solution = new GQAPSolution(assignment, quality, flowDistanceQuality, installationQuality, overbookedCapacity);
    161     }
    162     public GQAPAssignment(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity, StringArray equipmentNames, StringArray locationNames, DoubleMatrix distances, DoubleMatrix weights, DoubleMatrix installationCosts, DoubleArray demands, DoubleArray capacities, DoubleValue transportationCosts, DoubleValue overbookedCapacityPenalty)
    163       : this(assignment, quality, flowDistanceQuality, installationQuality, overbookedCapacity) {
     209      this.assignment = assignment;
     210      this.quality = quality;
     211      this.flowDistanceQuality = flowDistanceQuality;
     212      this.installationQuality = installationQuality;
     213      this.overbookedCapacity = overbookedCapacity;
    164214      this.equipmentNames = equipmentNames;
    165215      this.locationNames = locationNames;
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs

    r7466 r7470  
    8484      get { return (FixedValueParameter<DoubleValue>)Parameters["OverbookedCapacityPenalty"]; }
    8585    }
    86     public OptionalValueParameter<GQAPSolution> BestKnownSolutionParameter {
    87       get { return (OptionalValueParameter<GQAPSolution>)Parameters["BestKnownSolution"]; }
     86    public OptionalValueParameter<GQAPAssignment> BestKnownSolutionParameter {
     87      get { return (OptionalValueParameter<GQAPAssignment>)Parameters["BestKnownSolution"]; }
    8888    }
    8989    public OptionalValueParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter {
     
    135135      set { LocationNamesParameter.Value = value; }
    136136    }
    137     public GQAPSolution BestKnownSolution {
     137    public GQAPAssignment BestKnownSolution {
    138138      get { return BestKnownSolutionParameter.Value; }
    139139      set { BestKnownSolutionParameter.Value = value; }
     
    266266      try {
    267267        if (instance.Dimension > 1000) return false;
    268        
     268
    269269        Name = instance.Name;
    270270        Description = instance.Description;
     
    335335        out flowDistanceQuality, out installationQuality, out overbookedCapacity);
    336336      double quality = GQAPEvaluator.GetCombinedQuality(flowDistanceQuality, installationQuality, overbookedCapacity, TransportationCosts.Value, OverbookedCapacityPenalty.Value);
    337       BestKnownSolution = new GQAPSolution(assignment, new DoubleValue(quality), new DoubleValue(flowDistanceQuality), new DoubleValue(installationQuality), new DoubleValue(overbookedCapacity));
     337      BestKnownSolution = new GQAPAssignment(assignment, new DoubleValue(quality),
     338        new DoubleValue(flowDistanceQuality), new DoubleValue(installationQuality),
     339        new DoubleValue(overbookedCapacity), EquipmentNames, LocationNames, Distances, Weights, InstallationCosts,
     340        Demands, Capacities, TransportationCosts, OverbookedCapacityPenalty);
    338341      BestKnownQuality = new DoubleValue(quality);
    339342      BestKnownSolutions = new GQAPAssignmentArchive(EquipmentNames, LocationNames, Distances, Weights, InstallationCosts, Demands, Capacities, TransportationCosts, OverbookedCapacityPenalty);
    340       BestKnownSolutions.Solutions.Add((GQAPSolution)BestKnownSolution.Clone());
     343      BestKnownSolutions.Solutions.Add(BestKnownSolution);
    341344    }
    342345
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Interfaces/IBestKnownSolutionAwareGQAPOperator.cs

    r7443 r7470  
    2424namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    2525  public interface IBestKnownSolutionAwareGQAPOperator : IGQAPOperator {
    26     ILookupParameter<GQAPSolution> BestKnownSolutionParameter { get; }
     26    ILookupParameter<GQAPAssignment> BestKnownSolutionParameter { get; }
    2727  }
    2828}
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.TSPLIB/3.3/HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj

    r7466 r7470  
    132132    <EmbeddedResource Include="Data\TSP\lin105.tsp" />
    133133    <EmbeddedResource Include="Data\TSP\lin318.tsp" />
    134     <EmbeddedResource Include="Data\TSP\linhp318.tsp" />
    135134    <EmbeddedResource Include="Data\TSP\nrw1379.tsp" />
    136135    <EmbeddedResource Include="Data\TSP\p654.tsp" />
     
    234233    <Compile Include="Plugin.cs" />
    235234    <Compile Include="Properties\AssemblyInfo.cs" />
    236     <None Include="Properties\AssemblyInfo.frame" />
     235    <None Include="Properties\AssemblyInfo.cs.frame" />
    237236  </ItemGroup>
    238237  <ItemGroup>
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBParser.cs

    r7466 r7470  
    439439          break;
    440440        default:
    441           throw new InvalidDataException("Input files does not specify a valid node coord type.");
     441          throw new InvalidDataException("Input files does not specify a valid display data type.");
    442442      }
    443443
     
    525525        || edgeWeightFormat == TSPLIBEdgeWeightFormats.UPPER_ROW;
    526526
    527       int dim1 = !triangular && !upperTriangular ? (diagonal ? 0 : 1) : 0;
    528       int dim2 = !triangular && 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

    r7466 r7470  
    2929namespace HeuristicLab.Problems.Instances.TSPLIB {
    3030  public class TSPLIBTSPInstanceProvider : ProblemInstanceProvider<ITSPInstance> {
    31    
     31
    3232    public override string Name {
    3333      get { return "TSPLIB (symmetric TSP)"; }
     
    6464        var parser = new TSPLIBParser(stream);
    6565        parser.Parse();
     66        if (parser.FixedEdges != null) throw new InvalidDataException("TSP instance " + parser.Name + " contains fixed edges which are not supported by HeuristicLab.");
     67
    6668        instance.Dimension = parser.Dimension;
    6769        instance.Coordinates = parser.Vertices != null ? parser.Vertices : parser.DisplayVertices;
  • branches/GeneralizedQAP/UnitTests/TSPLIBInstanceProviderTest.cs

    r7465 r7470  
    44using Microsoft.VisualStudio.TestTools.UnitTesting;
    55
    6 namespace UnitTests
    7 {
    8    
    9    
    10     /// <summary>
    11     ///This is a test class for TSPLIBInstanceProviderTest and is intended
    12     ///to contain all TSPLIBInstanceProviderTest Unit Tests
    13     ///</summary>
     6namespace UnitTests {
    147  [TestClass()]
    158  public class TSPLIBInstanceProviderTest {
    16     /// <summary>
    17     ///A test for GetInstance
    18     ///</summary>
     9
    1910    [TestMethod()]
    2011    public void GetTSPLIBTSPInstanceTest() {
    21       TSPLIBTSPInstanceProvider target = new TSPLIBTSPInstanceProvider();
     12      var target = new TSPLIBTSPInstanceProvider();
     13      StringBuilder erroneousInstances = new StringBuilder();
     14      int count = 0;
     15      foreach (var id in target.GetInstanceDescriptors()) {
     16        try {
     17          target.GetInstance(id);
     18        } catch (Exception ex) {
     19          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
     20        }
     21        count++;
     22      }
     23      Assert.IsTrue(count > 0, "No problem instances were found.");
     24      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
     25    }
     26
     27    [TestMethod()]
     28    public void GetTSPLIBATSPInstanceTest() {
     29      var target = new TSPLIBATSPInstanceProvider();
     30      StringBuilder erroneousInstances = new StringBuilder();
     31      int count = 0;
     32      foreach (var id in target.GetInstanceDescriptors()) {
     33        try {
     34          target.GetInstance(id);
     35        } catch (Exception ex) {
     36          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
     37        }
     38        count++;
     39      }
     40      Assert.IsTrue(count > 0, "No problem instances were found.");
     41      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
     42    }
     43
     44    [TestMethod()]
     45    public void GetTSPLIBCVRPInstanceTest() {
     46      var target = new TSPLIBCVRPInstanceProvider();
    2247      StringBuilder erroneousInstances = new StringBuilder();
    2348      int count = 0;
  • branches/GeneralizedQAP/UnitTests/UnitTests.csproj

    r7465 r7470  
    9797  </ItemGroup>
    9898  <ItemGroup>
     99    <Compile Include="ElloumiCTAPInstanceProviderTest.cs" />
     100    <Compile Include="QAPLIBInstanceProviderTest.cs" />
    99101    <Compile Include="GQAPNMoveEvaluatorTest.cs" />
    100102    <Compile Include="Properties\AssemblyInfo.cs" />
     
    109111      <Project>{C739E6D2-5680-4804-A810-8017DA0C238F}</Project>
    110112      <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3</Name>
     113    </ProjectReference>
     114    <ProjectReference Include="..\HeuristicLab.Problems.Instances.ElloumiCTAP\3.3\HeuristicLab.Problems.Instances.ElloumiCTAP-3.3.csproj">
     115      <Project>{CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}</Project>
     116      <Name>HeuristicLab.Problems.Instances.ElloumiCTAP-3.3</Name>
     117    </ProjectReference>
     118    <ProjectReference Include="..\HeuristicLab.Problems.Instances.QAPLIB\3.3\HeuristicLab.Problems.Instances.QAPLIB-3.3.csproj">
     119      <Project>{73F29D43-5714-4069-8FAB-0D18FEB5F175}</Project>
     120      <Name>HeuristicLab.Problems.Instances.QAPLIB-3.3</Name>
    111121    </ProjectReference>
    112122    <ProjectReference Include="..\HeuristicLab.Problems.Instances.TSPLIB\3.3\HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj">
Note: See TracChangeset for help on using the changeset viewer.