diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorLight.java b/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorLight.java new file mode 100644 index 00000000..65353e1a --- /dev/null +++ b/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorLight.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * 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 + * 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 . + ******************************************************************************/ +package jsprit.core.algorithm.recreate; + +import jsprit.core.problem.job.Job; +import jsprit.core.problem.solution.route.VehicleRoute; + + +public interface JobInsertionCostsCalculatorLight { + + public InsertionData getInsertionData(Job unassignedJob, VehicleRoute route, double bestKnownCosts); + +} diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorFactory.java b/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorLightFactory.java similarity index 72% rename from jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorFactory.java rename to jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorLightFactory.java index a4140595..6884dad0 100644 --- a/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorFactory.java +++ b/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorLightFactory.java @@ -22,6 +22,8 @@ import jsprit.core.algorithm.recreate.listener.InsertionListener; import jsprit.core.algorithm.state.StateManager; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.constraint.ConstraintManager; +import jsprit.core.problem.job.Job; +import jsprit.core.problem.solution.route.VehicleRoute; import jsprit.core.problem.vehicle.VehicleFleetManager; import java.util.ArrayList; @@ -30,7 +32,7 @@ import java.util.List; /** * Created by schroeder on 11.12.14. */ -public class JobInsertionCostsCalculatorFactory { +public class JobInsertionCostsCalculatorLightFactory { /** * Returns standard insertion calculator, i.e. the calculator that identifies best insertion positions for the @@ -42,13 +44,20 @@ public class JobInsertionCostsCalculatorFactory { * @param constraintManager constraint manager * @return insertion calculator */ - public static JobInsertionCostsCalculator createStandardCalculator(VehicleRoutingProblem vrp, VehicleFleetManager fleetManager, StateManager stateManager, ConstraintManager constraintManager){ + public static JobInsertionCostsCalculatorLight createStandardCalculator(VehicleRoutingProblem vrp, VehicleFleetManager fleetManager, StateManager stateManager, ConstraintManager constraintManager){ List al = new ArrayList(); List il = new ArrayList(); JobInsertionCostsCalculatorBuilder builder = new JobInsertionCostsCalculatorBuilder(il,al); builder.setVehicleRoutingProblem(vrp).setConstraintManager(constraintManager).setStateManager(stateManager).setVehicleFleetManager(fleetManager); - JobInsertionCostsCalculator calculator = builder.build(); - return calculator; + final JobInsertionCostsCalculator calculator = builder.build(); + return new JobInsertionCostsCalculatorLight() { + + @Override + public InsertionData getInsertionData(Job unassignedJob, VehicleRoute route, double bestKnownCosts) { + return calculator.getInsertionData(route,unassignedJob,AbstractInsertionStrategy.NO_NEW_VEHICLE_YET,AbstractInsertionStrategy.NO_NEW_DEPARTURE_TIME_YET,AbstractInsertionStrategy.NO_NEW_DRIVER_YET,bestKnownCosts); + } + + }; } }