mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
parameterize construction algo
This commit is contained in:
parent
e215ea76d8
commit
1848f22fe3
1 changed files with 27 additions and 3 deletions
|
|
@ -36,6 +36,22 @@ import java.util.concurrent.Executors;
|
|||
*/
|
||||
public class Jsprit {
|
||||
|
||||
public enum Construction {
|
||||
|
||||
BEST_INSERTION("best_insertion"), REGRET_INSERTION("regret_insertion");
|
||||
|
||||
String name;
|
||||
|
||||
Construction(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum Strategy {
|
||||
|
||||
RADIAL_BEST("radial_best"),
|
||||
|
|
@ -78,7 +94,8 @@ public class Jsprit {
|
|||
INSERTION_NOISE_LEVEL("insertion.noise_level"),
|
||||
INSERTION_NOISE_PROB("insertion.noise_prob"),
|
||||
RUIN_WORST_NOISE_LEVEL("worst.noise_level"),
|
||||
RUIN_WORST_NOISE_PROB("worst.noise_prob");
|
||||
RUIN_WORST_NOISE_PROB("worst.noise_prob"),
|
||||
CONSTRUCTION("construction");
|
||||
|
||||
String paraName;
|
||||
|
||||
|
|
@ -160,6 +177,7 @@ public class Jsprit {
|
|||
defaults.put(Parameter.RUIN_WORST_NOISE_LEVEL.toString(),String.valueOf(0.15));
|
||||
defaults.put(Parameter.RUIN_WORST_NOISE_PROB.toString(),String.valueOf(0.2));
|
||||
defaults.put(Parameter.VEHICLE_SWITCH.toString(),String.valueOf(true));
|
||||
defaults.put(Parameter.CONSTRUCTION.toString(),Construction.REGRET_INSERTION.toString());
|
||||
return defaults;
|
||||
}
|
||||
|
||||
|
|
@ -419,8 +437,14 @@ public class Jsprit {
|
|||
.withStrategy(worst_best, toDouble(getProperty(Strategy.WORST_BEST.toString())))
|
||||
.withStrategy(worst_regret, toDouble(getProperty(Strategy.WORST_REGRET.toString())))
|
||||
.withStrategy(clusters_regret,toDouble(getProperty(Strategy.CLUSTER_REGRET.toString())))
|
||||
.withStrategy(clusters_best,toDouble(getProperty(Strategy.CLUSTER_BEST.toString())))
|
||||
.constructInitialSolutionWith(regret, objectiveFunction);
|
||||
.withStrategy(clusters_best,toDouble(getProperty(Strategy.CLUSTER_BEST.toString())));
|
||||
if (getProperty(Parameter.CONSTRUCTION.toString()).equals(Construction.BEST_INSERTION.toString())){
|
||||
prettyBuilder.constructInitialSolutionWith(best, objectiveFunction);
|
||||
}
|
||||
else{
|
||||
prettyBuilder.constructInitialSolutionWith(regret, objectiveFunction);
|
||||
}
|
||||
|
||||
|
||||
VehicleRoutingAlgorithm vra = prettyBuilder.build();
|
||||
vra.addListener(schrimpfThreshold);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue