mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
make greedySchrimpfFactory read url + add read(url) method to
VehicleRoutingAlgorithms to also read urls
This commit is contained in:
parent
77ec47cf2a
commit
76bce6b3da
2 changed files with 9 additions and 1 deletions
|
|
@ -64,7 +64,7 @@ public class GreedySchrimpfFactory {
|
||||||
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp){
|
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp){
|
||||||
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||||
URL resource = Resource.getAsURL("greedySchrimpf.xml");
|
URL resource = Resource.getAsURL("greedySchrimpf.xml");
|
||||||
new AlgorithmConfigXmlReader(algorithmConfig).read(resource.getPath());
|
new AlgorithmConfigXmlReader(algorithmConfig).read(resource);
|
||||||
return VehicleRoutingAlgorithms.createAlgorithm(vrp, algorithmConfig);
|
return VehicleRoutingAlgorithms.createAlgorithm(vrp, algorithmConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
package algorithms;
|
package algorithms;
|
||||||
|
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -367,6 +368,13 @@ public class VehicleRoutingAlgorithms {
|
||||||
return createAlgo(vrp,config);
|
return createAlgo(vrp,config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, final URL configURL){
|
||||||
|
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||||
|
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
||||||
|
xmlReader.read(configURL);
|
||||||
|
return createAlgo(vrp,algorithmConfig.getXMLConfiguration());
|
||||||
|
}
|
||||||
|
|
||||||
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, final String configFileName){
|
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, final String configFileName){
|
||||||
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||||
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue