mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
improve fix cost calc
This commit is contained in:
parent
6901504854
commit
a54315f28a
1 changed files with 7 additions and 11 deletions
|
|
@ -66,10 +66,10 @@ final class JobInsertionConsideringFixCostsCalculator implements JobInsertionCos
|
||||||
return insertionData;
|
return insertionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getFixCostContribution(final VehicleRoute currentRoute,
|
private double getFixCostContribution(final VehicleRoute currentRoute, final Job jobToInsert, final Vehicle newVehicle) {
|
||||||
final Job jobToInsert, final Vehicle newVehicle) {
|
Capacity currentMaxLoadInRoute = getCurrentMaxLoadInRoute(currentRoute);
|
||||||
double relFixCost = getDeltaRelativeFixCost(currentRoute, newVehicle, jobToInsert);
|
double relFixCost = getDeltaRelativeFixCost(currentRoute, newVehicle, jobToInsert,currentMaxLoadInRoute);
|
||||||
double absFixCost = getDeltaAbsoluteFixCost(currentRoute, newVehicle, jobToInsert);
|
double absFixCost = getDeltaAbsoluteFixCost(currentRoute, newVehicle, jobToInsert,currentMaxLoadInRoute);
|
||||||
double deltaFixCost = (1 - solution_completeness_ratio) * relFixCost + solution_completeness_ratio * absFixCost;
|
double deltaFixCost = (1 - solution_completeness_ratio) * relFixCost + solution_completeness_ratio * absFixCost;
|
||||||
double fixcost_contribution = weight_deltaFixCost * solution_completeness_ratio * deltaFixCost;
|
double fixcost_contribution = weight_deltaFixCost * solution_completeness_ratio * deltaFixCost;
|
||||||
return fixcost_contribution;
|
return fixcost_contribution;
|
||||||
|
|
@ -89,9 +89,8 @@ final class JobInsertionConsideringFixCostsCalculator implements JobInsertionCos
|
||||||
solution_completeness_ratio = ratio;
|
solution_completeness_ratio = ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getDeltaAbsoluteFixCost(VehicleRoute route, Vehicle newVehicle, Job job) {
|
private double getDeltaAbsoluteFixCost(VehicleRoute route, Vehicle newVehicle, Job job, Capacity currentMaxLoadInRoute) {
|
||||||
Capacity load = Capacity.addup(getCurrentMaxLoadInRoute(route), job.getSize());
|
Capacity load = Capacity.addup(currentMaxLoadInRoute, job.getSize());
|
||||||
// double load = getCurrentMaxLoadInRoute(route) + job.getCapacityDemand();
|
|
||||||
double currentFix = 0.0;
|
double currentFix = 0.0;
|
||||||
if (route.getVehicle() != null) {
|
if (route.getVehicle() != null) {
|
||||||
if (!(route.getVehicle() instanceof NoVehicle)) {
|
if (!(route.getVehicle() instanceof NoVehicle)) {
|
||||||
|
|
@ -104,11 +103,8 @@ final class JobInsertionConsideringFixCostsCalculator implements JobInsertionCos
|
||||||
return newVehicle.getType().getVehicleCostParams().fix - currentFix;
|
return newVehicle.getType().getVehicleCostParams().fix - currentFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getDeltaRelativeFixCost(VehicleRoute route, Vehicle newVehicle, Job job) {
|
private double getDeltaRelativeFixCost(VehicleRoute route, Vehicle newVehicle, Job job, Capacity currentLoad) {
|
||||||
Capacity currentLoad = getCurrentMaxLoadInRoute(route);
|
|
||||||
// int currentLoad = getCurrentMaxLoadInRoute(route);
|
|
||||||
Capacity load = Capacity.addup(currentLoad, job.getSize());
|
Capacity load = Capacity.addup(currentLoad, job.getSize());
|
||||||
// double load = currentLoad + job.getCapacityDemand();
|
|
||||||
double currentRelFix = 0.0;
|
double currentRelFix = 0.0;
|
||||||
if (route.getVehicle() != null) {
|
if (route.getVehicle() != null) {
|
||||||
if (!(route.getVehicle() instanceof NoVehicle)) {
|
if (!(route.getVehicle() instanceof NoVehicle)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue