Changeset 7416 for trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs
- Timestamp:
- 01/26/12 16:28:17 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs
r7259 r7416 205 205 Bitmap newBitmap = null; 206 206 stressLabel.Text = "-"; 207 stressLabel.ForeColor = Color.Black; 207 208 if (distancesRadioButton.Checked && Distances != null && Distances.Rows > 0 208 209 && Distances.Rows == Distances.Columns) { 209 if (Distances.Rows > 35) {210 if (Distances.Rows > 50) { 210 211 newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height); 211 212 WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization."); … … 214 215 } else if (weightsRadioButton.Checked && Weights != null && Weights.Rows > 0 215 216 && Weights.Rows == Weights.Columns) { 216 if (Weights.Rows > 35) {217 if (Weights.Rows > 50) { 217 218 newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height); 218 219 WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization."); … … 228 229 && Assignment.Length == Distances.Rows 229 230 && Assignment.Validate()) { 230 if (Assignment.Length > 35) {231 if (Assignment.Length > 50) { 231 232 newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height); 232 233 WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization."); … … 249 250 Bitmap newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height); 250 251 stressLabel.Text = "-"; 252 stressLabel.ForeColor = Color.Black; 251 253 WriteCenteredTextToBitmap(ref newBitmap, "Please refresh view."); 252 254 showingMessage = false; // we're showing a message, but we should be showing the visualization, so this is false … … 270 272 stress = MultidimensionalScaling.CalculateNormalizedStress(distances, coordinates); 271 273 stressLabel.Text = stress.ToString("0.00", CultureInfo.CurrentCulture.NumberFormat); 274 if (stress < 0.1) stressLabel.ForeColor = Color.DarkGreen; 275 else if (stress < 0.2) stressLabel.ForeColor = Color.DarkOrange; 276 else stressLabel.ForeColor = Color.DarkRed; 272 277 } catch { 273 278 WriteCenteredTextToBitmap(ref newBitmap, "Distance matrix is not symmetric"); 274 279 showingMessage = true; 275 280 stressLabel.Text = "-"; 281 stressLabel.ForeColor = Color.Black; 276 282 return newBitmap; 277 283 } … … 349 355 for (int i = 0; i < weights.Rows; i++) 350 356 for (int j = i + 1; j < weights.Rows; j++) { 351 if (weights[i, j] > maxWeight) 352 maxWeight = weights[i, j] +weights[j, i];357 if (weights[i, j] > maxWeight) maxWeight = weights[i, j]; 358 if (weights[j, i] > maxWeight) maxWeight = weights[j, i]; 353 359 } 354 360 … … 356 362 for (int i = 0; i < distances.Rows; i++) 357 363 for (int j = 0; j < distances.Columns; j++) { 358 distances[i, j] = maxWeight + 1 - weights[i, j]; 364 if (weights[i, j] == 0) distances[i, j] = double.NaN; 365 else distances[i, j] = maxWeight / weights[i, j]; 359 366 } 360 367 … … 365 372 stress = MultidimensionalScaling.CalculateNormalizedStress(distances, coordinates); 366 373 stressLabel.Text = stress.ToString("0.00", CultureInfo.CurrentCulture.NumberFormat); 374 if (stress < 0.1) stressLabel.ForeColor = Color.DarkGreen; 375 else if (stress < 0.2) stressLabel.ForeColor = Color.DarkOrange; 376 else stressLabel.ForeColor = Color.DarkRed; 367 377 } catch { 368 378 WriteCenteredTextToBitmap(ref newBitmap, "Weights matrix is not symmetric"); 369 379 showingMessage = true; 370 380 stressLabel.Text = "-"; 381 stressLabel.ForeColor = Color.Black; 371 382 return newBitmap; 372 383 } … … 454 465 stress = MultidimensionalScaling.CalculateNormalizedStress(distances, coordinates); 455 466 stressLabel.Text = stress.ToString("0.00", CultureInfo.CurrentCulture.NumberFormat); 467 if (stress < 0.1) stressLabel.ForeColor = Color.DarkGreen; 468 else if (stress < 0.2) stressLabel.ForeColor = Color.DarkOrange; 469 else stressLabel.ForeColor = Color.DarkRed; 456 470 } catch { 457 471 WriteCenteredTextToBitmap(ref newBitmap, "Unknown error"); 458 472 showingMessage = true; 459 473 stressLabel.Text = "-"; 474 stressLabel.ForeColor = Color.Black; 460 475 return newBitmap; 461 476 }
Note: See TracChangeset
for help on using the changeset viewer.