Closed HeuristicLab-Trac-Bot closed 12 years ago
Follow-up from ticket #1333: The distance matrix should not be calculated in the evaluators but in the problem itself (for example during the import or by a specific user action).
part of #1782 was to update the TSPLIB parser. It can now parse any file in TSPLIB format, including those that are only specified by a distance matrix. Also a TSPDistanceMatrixEvaluator was created when integrating this into the trunk. When this evaluator is selected, the distance matrix will not be cleared when the coordinates change.
- Fixed loading of instances that did not specify coordinates (visual or actual ones)
- Turned coordinates into an
OptionalValueParameter
- Added checks in relevant operators that throw an exception if they can neither find coordinates or distances
- Writing a message to the visualization if coordinates are not defined
Reviewed r7621 and tested the optimization of TSP problems with no given coordinates and everything works as expected, except changing of the evaluator (also with the
DistanceMatrixEvaluator
) which leads to an exception. I think there is a wiring mistake in the TSPProblem.
Actually it's a configuration mistake: The problematic case is when you switch to the TSPDistanceMatrixEvaluator, but there's no DistanceMatrix defined or when you want a coordinate based evaluator, but there are no Coordinates defined. I would want to throw an exception in this case, but cannot as this not caught anywhere and would crash the optimizer. Here's the responsible code:
private void ParameterizeSolutionCreator() { if (Evaluator is ITSPDistanceMatrixEvaluator && DistanceMatrix != null) SolutionCreator.LengthParameter.Value = new IntValue(DistanceMatrix.Rows); else if (Evaluator is ITSPCoordinatesPathEvaluator && Coordinates != null) SolutionCreator.LengthParameter.Value = new IntValue(Coordinates.Rows); else SolutionCreator.LengthParameter.Value = null; SolutionCreator.LengthParameter.Hidden = SolutionCreator.LengthParameter.Value != null; SolutionCreator.PermutationTypeParameter.Value = new PermutationType(PermutationTypes.RelativeUndirected); SolutionCreator.PermutationTypeParameter.Hidden = true; }
In r8208 I added code to show only error dialog when the evaluator is currently not supported so that the user is immediately informed. This in turn required an explicit dependency to System.Windows.Forms. It should be a rare case as the users normally don't have to touch the evaluators a lot. Do you think this is enough to handle this issue?
Reviewed r8208 and the source looks ok, but loading different problem instances does not work correctly (e.g., gil262 => fri26).
r8221: fixed loading errors when switching from coordinates to distance matrix evaluation
Thanks for the test case. I think it should work correctly now.
Issue migrated from trac ticket # 1396
milestone: HeuristicLab 3.3.7 | component: Problems.TravelingSalesman | priority: highest | resolution: done
2011-01-26 22:04:14: @s-wagner created the issue