Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/11 01:49:10 (14 years ago)
Author:
abeham
Message:

#1330

  • Unified QAP visualization in solution and problem view
  • Fixed bug in gradient-descent gradient calculation when performing multidimensional scaling
  • Extended QAPLIB parsers to cover some file format variations
  • Added unit tests to check if all QAPLIB instances import without error
  • Changed BestKnownSolution to be an OptionalValueParameter
Location:
branches/QAP
Files:
5 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/QAP

    • Property svn:ignore
      •  

        old new  
        11*.suo
         2TestResults
  • branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Parsers/QAPLIBParser.cs

    r5563 r5648  
    4141        Distances = new double[Size, Size];
    4242        Weights = new double[Size, Size];
    43         reader.ReadLine();
     43        string valLine = reader.ReadLine();
    4444        char[] delim = new char[] { ' ' };
    4545        for (int i = 0; i < Size; i++) {
    46           string valLine = reader.ReadLine();
     46          if (i > 0 || String.IsNullOrWhiteSpace(valLine))
     47            valLine = reader.ReadLine();
    4748          string[] vals = new string[Size];
    4849          string[] partVals = valLine.Split(delim, StringSplitOptions.RemoveEmptyEntries);
     
    5960          }
    6061        }
    61         reader.ReadLine();
     62        valLine = reader.ReadLine();
    6263        int read = 0;
    6364        int k = 0;
    6465        while (!reader.EndOfStream) {
    65           string valLine = reader.ReadLine();
     66          if (read > 0 || String.IsNullOrWhiteSpace(valLine))
     67            valLine = reader.ReadLine();
    6668          string[] vals = valLine.Split(delim, StringSplitOptions.RemoveEmptyEntries);
    6769          for (int j = 0; j < vals.Length; j++) {
  • branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Parsers/QAPLIBSolutionParser.cs

    r5598 r5648  
    3838      try {
    3939        StreamReader reader = new StreamReader(stream);
    40         char[] delim = new char[] { ' ' };
     40        char[] delim = new char[] { ' ', ',' }; // comma is added for nug30.sln which is the only file that separates the permutation with commas
    4141        string[] firstline = reader.ReadLine().Split(delim, StringSplitOptions.RemoveEmptyEntries);
    4242        Size = int.Parse(firstline[0]);
  • branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/QAPAssignment.cs

    r5641 r5648  
    1818        coordinates = value;
    1919        if (changed) OnPropertyChanged("Coordinates");
    20       }
    21     }
    22 
    23     [Storable]
    24     private DoubleMatrix viewCoordinates;
    25     public DoubleMatrix ViewCoordinates {
    26       get { return viewCoordinates; }
    27       set {
    28         bool changed = (viewCoordinates != value);
    29         viewCoordinates = value;
    30         if (changed) OnPropertyChanged("ViewCoordinates");
    3120      }
    3221    }
     
    8574      assignment = cloner.Clone(original.assignment);
    8675      quality = cloner.Clone(original.quality);
    87       viewCoordinates = cloner.Clone(original.viewCoordinates);
    8876    }
    8977    public QAPAssignment(DoubleMatrix weights, Permutation assignment) {
  • branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs

    r5641 r5648  
    103103    public QuadraticAssignmentProblem()
    104104      : base() {
    105       Parameters.Add(new ValueParameter<Permutation>("BestKnownSolution", "The best known solution which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
     105      Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
    106106      Parameters.Add(new ValueParameter<DoubleMatrix>("Coordinates", "The coordinates of the locations. If this is changed the distance matrix is calculated automatically using the euclidean distance."));
    107107      Parameters.Add(new ValueParameter<DoubleMatrix>("Weights", "The strength of the connection between the facilities.", new DoubleMatrix(5, 5)));
     
    272272    private void UpdateDistanceMatrix() {
    273273      if (Coordinates != null && Coordinates.Columns == 2 && Coordinates.Rows > 1) {
    274         DistanceMatrix = new DoubleMatrix(Coordinates.Rows, Coordinates.Rows);
     274        DoubleMatrix distance = new DoubleMatrix(Coordinates.Rows, Coordinates.Rows);
    275275        for (int i = 0; i < Coordinates.Rows - 1; i++) {
    276276          for (int j = i + 1; j < Coordinates.Rows; j++) {
    277277            double dx = Coordinates[i, 0] - Coordinates[j, 0];
    278278            double dy = Coordinates[i, 1] - Coordinates[j, 1];
    279             DistanceMatrix[i, j] = Math.Sqrt(dx * dx + dy * dy);
    280             DistanceMatrix[j, i] = DistanceMatrix[i, j];
     279            distance[i, j] = Math.Sqrt(dx * dx + dy * dy);
     280            distance[j, i] = DistanceMatrix[i, j];
    281281          }
    282282        }
     283        DistanceMatrix = distance;
    283284      }
    284285    }
Note: See TracChangeset for help on using the changeset viewer.