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

replace get/setDeliveryLocation(...) with get/setDeliveryLocationId(...)

replace get/setPickupLocation(...) with get/setPickupLocationId(...)
This commit is contained in:
oblonski 2014-09-04 14:02:43 +02:00
parent 9971d3d349
commit afe98c1051
22 changed files with 278 additions and 308 deletions

View file

@ -1,16 +1,16 @@
/*******************************************************************************
* Copyright (C) 2013 Stefan Schroeder
*
* Copyright (C) 2014 Stefan Schroeder
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
@ -121,7 +121,7 @@ class Inserter {
}
private void setEndLocation(VehicleRoute route, Shipment shipment) {
route.getEnd().setLocationId(shipment.getDeliveryLocation());
route.getEnd().setLocationId(shipment.getDeliveryLocationId());
}
public void setNextHandler(JobInsertionHandler jobInsertionHandler){

View file

@ -1,16 +1,16 @@
/*******************************************************************************
* Copyright (C) 2013 Stefan Schroeder
*
* Copyright (C) 2014 Stefan Schroeder
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
@ -74,16 +74,16 @@ public class AvgServiceAndShipmentDistance implements JobDistance {
}
private double calcDist(Service i, Shipment j) {
double c_ij1 = calcDist(i.getLocationId(),i.getCoord(),j.getPickupLocation(),j.getPickupCoord());
double c_ij2 = calcDist(i.getLocationId(),i.getCoord(),j.getDeliveryLocation(),j.getDeliveryCoord());
double c_ij1 = calcDist(i.getLocationId(),i.getCoord(),j.getPickupLocationId(),j.getPickupCoord());
double c_ij2 = calcDist(i.getLocationId(),i.getCoord(),j.getDeliveryLocationId(),j.getDeliveryCoord());
return (c_ij1 + c_ij2)/2.0;
}
private double calcDist(Shipment i, Shipment j) {
double c_i1j1 = calcDist(i.getPickupLocation(),i.getPickupCoord(),j.getPickupLocation(),j.getPickupCoord());
double c_i1j2 = calcDist(i.getPickupLocation(),i.getPickupCoord(),j.getDeliveryLocation(),j.getDeliveryCoord());
double c_i2j1 = calcDist(i.getDeliveryLocation(),i.getDeliveryCoord(),j.getPickupLocation(),j.getPickupCoord());
double c_i2j2 = calcDist(i.getDeliveryLocation(),i.getDeliveryCoord(),j.getDeliveryLocation(),j.getDeliveryCoord());
double c_i1j1 = calcDist(i.getPickupLocationId(),i.getPickupCoord(),j.getPickupLocationId(),j.getPickupCoord());
double c_i1j2 = calcDist(i.getPickupLocationId(),i.getPickupCoord(),j.getDeliveryLocationId(),j.getDeliveryCoord());
double c_i2j1 = calcDist(i.getDeliveryLocationId(),i.getDeliveryCoord(),j.getPickupLocationId(),j.getPickupCoord());
double c_i2j2 = calcDist(i.getDeliveryLocationId(),i.getDeliveryCoord(),j.getDeliveryLocationId(),j.getDeliveryCoord());
return (c_i1j1 + c_i1j2 + c_i2j1 + c_i2j2)/4.0;
}

View file

@ -1,16 +1,16 @@
/*******************************************************************************
* Copyright (C) 2013 Stefan Schroeder
*
* Copyright (C) 2014 Stefan Schroeder
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
@ -265,8 +265,8 @@ public class VehicleRoutingProblem {
}
else if(job instanceof Shipment){
Shipment shipment = (Shipment)job;
tentative_coordinates.put(shipment.getPickupLocation(), shipment.getPickupCoord());
tentative_coordinates.put(shipment.getDeliveryLocation(), shipment.getDeliveryCoord());
tentative_coordinates.put(shipment.getPickupLocationId(), shipment.getPickupCoord());
tentative_coordinates.put(shipment.getDeliveryLocationId(), shipment.getDeliveryCoord());
}
}
@ -310,8 +310,8 @@ public class VehicleRoutingProblem {
if (job instanceof Service) tentative_coordinates.put(((Service) job).getLocationId(), ((Service) job).getCoord());
if (job instanceof Shipment) {
Shipment shipment = (Shipment) job;
tentative_coordinates.put(shipment.getPickupLocation(), shipment.getPickupCoord());
tentative_coordinates.put(shipment.getDeliveryLocation(), shipment.getDeliveryCoord());
tentative_coordinates.put(shipment.getPickupLocationId(), shipment.getPickupCoord());
tentative_coordinates.put(shipment.getDeliveryLocationId(), shipment.getDeliveryCoord());
}
}
@ -333,8 +333,8 @@ public class VehicleRoutingProblem {
private void addShipment(Shipment job) {
if(jobs.containsKey(job.getId())){ logger.warn("job " + job + " already in job list. overrides existing job."); }
tentative_coordinates.put(job.getPickupLocation(), job.getPickupCoord());
tentative_coordinates.put(job.getDeliveryLocation(), job.getDeliveryCoord());
tentative_coordinates.put(job.getPickupLocationId(), job.getPickupCoord());
tentative_coordinates.put(job.getDeliveryLocationId(), job.getDeliveryCoord());
jobs.put(job.getId(),job);
}

View file

@ -1,20 +1,18 @@
/*******************************************************************************
* Copyright (c) 2014 Stefan Schroeder.
*
* Copyright (C) 2014 Stefan Schroeder
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Stefan Schroeder - initial API and implementation
******************************************************************************/
package jsprit.core.problem.solution.route.activity;
@ -60,7 +58,7 @@ public final class DeliverShipment extends AbstractActivity implements DeliveryA
@Override
public String getLocationId() {
return shipment.getDeliveryLocation();
return shipment.getDeliveryLocationId();
}
@Override

View file

@ -1,20 +1,18 @@
/*******************************************************************************
* Copyright (c) 2014 Stefan Schroeder.
*
* Copyright (C) 2014 Stefan Schroeder
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Stefan Schroeder - initial API and implementation
******************************************************************************/
package jsprit.core.problem.solution.route.activity;
@ -56,7 +54,7 @@ public final class PickupShipment extends AbstractActivity implements PickupActi
@Override
public String getLocationId() {
return shipment.getPickupLocation();
return shipment.getPickupLocationId();
}
@Override