1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

Fix a bug where one gets an error message (solutionSelector is not know. Currently, it only knows "selectRandom" and "selectBest") when he uses selectRandomly as a selector. But selectRandom is not a valid enumeration in the selectorType restriction in the algorithm_schema.xsd.

This commit is contained in:
Pierre-David Bélanger 2014-07-30 22:48:34 -04:00
parent 81a7b34b04
commit e1d5f3165a

View file

@ -746,7 +746,7 @@ public class VehicleRoutingAlgorithms {
private static SolutionSelector getSelector(HierarchicalConfiguration strategyConfig, VehicleRoutingProblem vrp, Set<PrioritizedVRAListener> algorithmListeners, TypedMap definedSelectors) { private static SolutionSelector getSelector(HierarchicalConfiguration strategyConfig, VehicleRoutingProblem vrp, Set<PrioritizedVRAListener> algorithmListeners, TypedMap definedSelectors) {
String selectorName = strategyConfig.getString("selector[@name]"); String selectorName = strategyConfig.getString("selector[@name]");
if(selectorName == null) throw new IllegalStateException("no solutionSelector defined. define either \"selectRandom\" or \"selectBest\""); if(selectorName == null) throw new IllegalStateException("no solutionSelector defined. define either \"selectRandomly\" or \"selectBest\"");
String selectorId = strategyConfig.getString("selector[@id]"); String selectorId = strategyConfig.getString("selector[@id]");
if(selectorId == null) selectorId="noId"; if(selectorId == null) selectorId="noId";
ModKey modKey = makeKey(selectorName,selectorId); ModKey modKey = makeKey(selectorName,selectorId);
@ -755,7 +755,7 @@ public class VehicleRoutingAlgorithms {
if(definedSelector != null) { if(definedSelector != null) {
return definedSelector; return definedSelector;
} }
if(selectorName.equals("selectRandom")){ if(selectorName.equals("selectRandomly")){
SelectRandomly selector = SelectRandomly.getInstance(); SelectRandomly selector = SelectRandomly.getInstance();
definedSelectors.put(selectorKey, selector); definedSelectors.put(selectorKey, selector);
return selector; return selector;
@ -765,7 +765,7 @@ public class VehicleRoutingAlgorithms {
definedSelectors.put(selectorKey, selector); definedSelectors.put(selectorKey, selector);
return selector; return selector;
} }
throw new IllegalStateException("solutionSelector is not know. Currently, it only knows \"selectRandom\" and \"selectBest\""); throw new IllegalStateException("solutionSelector is not know. Currently, it only knows \"selectRandomly\" and \"selectBest\"");
} }
private static ModKey makeKey(String name, String id){ private static ModKey makeKey(String name, String id){