1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00
This commit is contained in:
oblonski 2014-07-30 11:07:44 +02:00
parent fee2a396d9
commit bca9323c67
5 changed files with 20 additions and 12 deletions

View file

@ -60,8 +60,7 @@ public final class InsertionInitialSolutionFactory implements InitialSolutionFac
} }
private List<Job> getUnassignedJobs(VehicleRoutingProblem vrp) { private List<Job> getUnassignedJobs(VehicleRoutingProblem vrp) {
List<Job> jobs = new ArrayList<Job>(vrp.getJobs().values()); return new ArrayList<Job>(vrp.getJobs().values());
return jobs;
} }
} }

View file

@ -16,8 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.core.algorithm.box; package jsprit.core.algorithm.box;
import java.net.URL;
import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithm;
import jsprit.core.algorithm.io.AlgorithmConfig; import jsprit.core.algorithm.io.AlgorithmConfig;
import jsprit.core.algorithm.io.AlgorithmConfigXmlReader; import jsprit.core.algorithm.io.AlgorithmConfigXmlReader;
@ -25,6 +23,8 @@ import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.util.Resource; import jsprit.core.util.Resource;
import java.net.URL;
/** /**
@ -51,7 +51,7 @@ public class SchrimpfFactory {
/** /**
* Creates the {@link VehicleRoutingAlgorithm}. * Creates the {@link VehicleRoutingAlgorithm}.
* *
* @param vrp * @param vrp the underlying vehicle routing problem
* @return algorithm * @return algorithm
*/ */
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp){ public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp){

View file

@ -474,7 +474,7 @@ public class VehicleRoutingAlgorithms {
ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager); ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
constraintManager.addTimeWindowConstraint(); constraintManager.addTimeWindowConstraint();
constraintManager.addLoadConstraint(); constraintManager.addLoadConstraint();
constraintManager.addSkillsConstraint(); // constraintManager.addSkillsConstraint();
return readAndCreateAlgorithm(vrp, config, nuOfThreads, null, stateManager, constraintManager, true); return readAndCreateAlgorithm(vrp, config, nuOfThreads, null, stateManager, constraintManager, true);
} }

View file

@ -60,7 +60,7 @@ final class VehicleTypeDependentJobInsertionCalculator implements JobInsertionCo
this.insertionCalculator = jobInsertionCalc; this.insertionCalculator = jobInsertionCalc;
this.vrp = vrp; this.vrp = vrp;
getInitialVehicleIds(); getInitialVehicleIds();
logger.info("inialise " + this); logger.info("initialise " + this);
} }
private void getInitialVehicleIds() { private void getInitialVehicleIds() {
@ -77,7 +77,8 @@ final class VehicleTypeDependentJobInsertionCalculator implements JobInsertionCo
/** /**
* @return the vehicleSwitchAllowed * @return the vehicleSwitchAllowed
*/ */
public boolean isVehicleSwitchAllowed() { @SuppressWarnings("UnusedDeclaration")
public boolean isVehicleSwitchAllowed() {
return vehicleSwitchAllowed; return vehicleSwitchAllowed;
} }
@ -124,8 +125,7 @@ final class VehicleTypeDependentJobInsertionCalculator implements JobInsertionCo
} }
private boolean isVehicleWithInitialRoute(Vehicle selectedVehicle) { private boolean isVehicleWithInitialRoute(Vehicle selectedVehicle) {
if(initialVehicleIds.contains(selectedVehicle.getId())) return true; return initialVehicleIds.contains(selectedVehicle.getId());
return false;
} }
} }

View file

@ -672,9 +672,18 @@ public class VehicleRoutingProblem {
public Map<String, Job> getJobs() { public Map<String, Job> getJobs() {
return Collections.unmodifiableMap(jobs); return Collections.unmodifiableMap(jobs);
} }
/**
* Returns a copy of initial vehicle routes.
*
* @return copied collection of initial vehicle routes
*/
public Collection<VehicleRoute> getInitialVehicleRoutes(){ public Collection<VehicleRoute> getInitialVehicleRoutes(){
return Collections.unmodifiableCollection(initialVehicleRoutes); Collection<VehicleRoute> copiedInitialRoutes = new ArrayList<VehicleRoute>();
for(VehicleRoute route : initialVehicleRoutes){
copiedInitialRoutes.add(VehicleRoute.copyOf(route));
}
return copiedInitialRoutes;
} }
/** /**