mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add option to set abs. initial threshold
This commit is contained in:
parent
c1c140e683
commit
69537d109c
1 changed files with 13 additions and 8 deletions
|
|
@ -112,6 +112,7 @@ public class Jsprit {
|
||||||
WORST_MAX_SHARE("worst.max_share"),
|
WORST_MAX_SHARE("worst.max_share"),
|
||||||
THRESHOLD_ALPHA("threshold.alpha"),
|
THRESHOLD_ALPHA("threshold.alpha"),
|
||||||
THRESHOLD_INI("threshold.ini"),
|
THRESHOLD_INI("threshold.ini"),
|
||||||
|
THRESHOLD_INI_ABS("threshold.ini_abs"),
|
||||||
INSERTION_NOISE_LEVEL("insertion.noise_level"),
|
INSERTION_NOISE_LEVEL("insertion.noise_level"),
|
||||||
INSERTION_NOISE_PROB("insertion.noise_prob"),
|
INSERTION_NOISE_PROB("insertion.noise_prob"),
|
||||||
RUIN_WORST_NOISE_LEVEL("worst.noise_level"),
|
RUIN_WORST_NOISE_LEVEL("worst.noise_level"),
|
||||||
|
|
@ -602,15 +603,19 @@ public class Jsprit {
|
||||||
IterationStartsListener schrimpfThreshold = null;
|
IterationStartsListener schrimpfThreshold = null;
|
||||||
if(acceptor == null) {
|
if(acceptor == null) {
|
||||||
final SchrimpfAcceptance schrimpfAcceptance = new SchrimpfAcceptance(1, toDouble(getProperty(Parameter.THRESHOLD_ALPHA.toString())));
|
final SchrimpfAcceptance schrimpfAcceptance = new SchrimpfAcceptance(1, toDouble(getProperty(Parameter.THRESHOLD_ALPHA.toString())));
|
||||||
schrimpfThreshold = new IterationStartsListener() {
|
if (properties.containsKey(Parameter.THRESHOLD_INI_ABS.toString())) {
|
||||||
@Override
|
schrimpfAcceptance.setInitialThreshold(Double.valueOf(properties.getProperty(Parameter.THRESHOLD_INI_ABS.toString())));
|
||||||
public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
} else {
|
||||||
if (i == 1) {
|
schrimpfThreshold = new IterationStartsListener() {
|
||||||
double initialThreshold = Solutions.bestOf(solutions).getCost() * toDouble(getProperty(Parameter.THRESHOLD_INI.toString()));
|
@Override
|
||||||
schrimpfAcceptance.setInitialThreshold(initialThreshold);
|
public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||||
|
if (i == 1) {
|
||||||
|
double initialThreshold = Solutions.bestOf(solutions).getCost() * toDouble(getProperty(Parameter.THRESHOLD_INI.toString()));
|
||||||
|
schrimpfAcceptance.setInitialThreshold(initialThreshold);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
acceptor = schrimpfAcceptance;
|
acceptor = schrimpfAcceptance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue