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

Merge pull request #175 from HeinrichFilter/logging-improvements

[Fix #173] Updated all logging statements to use parameter substitution
This commit is contained in:
Stefan Schröder 2015-08-10 21:59:21 +02:00
commit 0df651c0dc
36 changed files with 79 additions and 79 deletions

View file

@ -88,7 +88,7 @@ public class SearchStrategy {
this.solutionAcceptor = solutionAcceptor; this.solutionAcceptor = solutionAcceptor;
this.solutionCostCalculator = solutionCostCalculator; this.solutionCostCalculator = solutionCostCalculator;
this.id = id; this.id = id;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
public String getId() { public String getId() {
@ -159,7 +159,7 @@ public class SearchStrategy {
public void addModule(SearchStrategyModule module){ public void addModule(SearchStrategyModule module){
if(module == null) throw new IllegalStateException("module to be added is null."); if(module == null) throw new IllegalStateException("module to be added is null.");
searchStrategyModules.add(module); searchStrategyModules.add(module);
logger.debug("module added [module=" + module + "][#modules=" + searchStrategyModules.size() + "]"); logger.debug("module added [module={}][#modules={}]", module, searchStrategyModules.size());
} }
public void addModuleListener(SearchStrategyModuleListener moduleListener) { public void addModuleListener(SearchStrategyModuleListener moduleListener) {

View file

@ -142,8 +142,8 @@ public class VehicleRoutingAlgorithm {
} }
} }
if(nuJobs != problem.getJobs().values().size()){ if(nuJobs != problem.getJobs().values().size()){
logger.warn("number of jobs in initial solution (" + nuJobs + ") is not equal nuJobs in vehicle routing problem (" + problem.getJobs().values().size() + ")" + logger.warn("number of jobs in initial solution ({}) is not equal nuJobs in vehicle routing problem ({})" +
"\n this might yield unintended effects, e.g. initial solution cannot be improved anymore."); "\n this might yield unintended effects, e.g. initial solution cannot be improved anymore.", nuJobs, problem.getJobs().values().size() );
} }
} }
@ -188,7 +188,7 @@ public class VehicleRoutingAlgorithm {
* @see {@link SearchStrategyManager}, {@link VehicleRoutingAlgorithmListener}, {@link AlgorithmStartsListener}, {@link AlgorithmEndsListener}, {@link IterationStartsListener}, {@link IterationEndsListener} * @see {@link SearchStrategyManager}, {@link VehicleRoutingAlgorithmListener}, {@link AlgorithmStartsListener}, {@link AlgorithmEndsListener}, {@link IterationStartsListener}, {@link IterationEndsListener}
*/ */
public Collection<VehicleRoutingProblemSolution> searchSolutions(){ public Collection<VehicleRoutingProblemSolution> searchSolutions(){
logger.info("algorithm starts: " + "[maxIterations=" + maxIterations + "]"); logger.info("algorithm starts: [maxIterations={}]", maxIterations);
double now = System.currentTimeMillis(); double now = System.currentTimeMillis();
int noIterationsThisAlgoIsRunning = maxIterations; int noIterationsThisAlgoIsRunning = maxIterations;
counter.reset(); counter.reset();
@ -198,24 +198,24 @@ public class VehicleRoutingAlgorithm {
logger.info("iterations start"); logger.info("iterations start");
for(int i=0;i< maxIterations;i++){ for(int i=0;i< maxIterations;i++){
iterationStarts(i+1,problem,solutions); iterationStarts(i+1,problem,solutions);
logger.debug("start iteration: " + i); logger.debug("start iteration: {}", i);
counter.incCounter(); counter.incCounter();
SearchStrategy strategy = searchStrategyManager.getRandomStrategy(); SearchStrategy strategy = searchStrategyManager.getRandomStrategy();
DiscoveredSolution discoveredSolution = strategy.run(problem, solutions); DiscoveredSolution discoveredSolution = strategy.run(problem, solutions);
logger.trace("discovered solution: " + discoveredSolution); logger.trace("discovered solution: {}", discoveredSolution);
memorizeIfBestEver(discoveredSolution); memorizeIfBestEver(discoveredSolution);
selectedStrategy(discoveredSolution,problem,solutions); selectedStrategy(discoveredSolution,problem,solutions);
if(terminationManager.isPrematureBreak(discoveredSolution)){ if(terminationManager.isPrematureBreak(discoveredSolution)){
logger.info("premature algorithm termination at iteration "+ (i+1)); logger.info("premature algorithm termination at iteration {}", (i+1));
noIterationsThisAlgoIsRunning = (i+1); noIterationsThisAlgoIsRunning = (i+1);
break; break;
} }
iterationEnds(i+1,problem,solutions); iterationEnds(i+1,problem,solutions);
} }
logger.info("iterations end at " + noIterationsThisAlgoIsRunning + " iterations"); logger.info("iterations end at {} iterations", noIterationsThisAlgoIsRunning);
addBestEver(solutions); addBestEver(solutions);
algorithmEnds(problem, solutions); algorithmEnds(problem, solutions);
logger.info("took " + ((System.currentTimeMillis()-now)/1000.0) + " seconds"); logger.info("took {} seconds", ((System.currentTimeMillis()-now)/1000.0));
return solutions; return solutions;
} }
@ -267,7 +267,7 @@ public class VehicleRoutingAlgorithm {
*/ */
public void setMaxIterations(int maxIterations) { public void setMaxIterations(int maxIterations) {
this.maxIterations = maxIterations; this.maxIterations = maxIterations;
logger.debug("set maxIterations to " + this.maxIterations); logger.debug("set maxIterations to {}", this.maxIterations);
} }
/** /**

View file

@ -57,7 +57,7 @@ public class ExperimentalSchrimpfAcceptance implements SolutionAcceptor, Iterati
this.alpha = alpha; this.alpha = alpha;
this.nOfRandomWalks = nOfWarmupIterations; this.nOfRandomWalks = nOfWarmupIterations;
this.solutionMemory = solutionMemory; this.solutionMemory = solutionMemory;
logger.info("initialise " + this); logger.info("initialise {}", this);
} }
@ -96,7 +96,7 @@ public class ExperimentalSchrimpfAcceptance implements SolutionAcceptor, Iterati
private double getThreshold(int iteration) { private double getThreshold(int iteration) {
double scheduleVariable = (double) iteration / (double) nOfTotalIterations; double scheduleVariable = (double) iteration / (double) nOfTotalIterations;
// logger.debug("iter="+iteration+" totalIter="+nOfTotalIterations+" scheduling="+scheduleVariable); // logger.debug("iter={} totalIter={} scheduling={}", iteration, nOfTotalIterations, scheduleVariable);
double currentThreshold = initialThreshold * Math.exp(-Math.log(2) * scheduleVariable / alpha); double currentThreshold = initialThreshold * Math.exp(-Math.log(2) * scheduleVariable / alpha);
return currentThreshold; return currentThreshold;
} }
@ -126,7 +126,7 @@ public class ExperimentalSchrimpfAcceptance implements SolutionAcceptor, Iterati
@Override @Override
public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) { public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
double result = Solutions.bestOf(solutions).getCost(); double result = Solutions.bestOf(solutions).getCost();
// logger.info("result="+result); // logger.info("result={}", result);
results[iteration-1] = result; results[iteration-1] = result;
} }
@ -138,8 +138,8 @@ public class ExperimentalSchrimpfAcceptance implements SolutionAcceptor, Iterati
initialThreshold = standardDeviation / 2; initialThreshold = standardDeviation / 2;
logger.info("warmup done"); logger.info("warmup done");
logger.info("total time: " + ((System.currentTimeMillis()-now)/1000.0) + "s"); logger.info("total time: {}s", ((System.currentTimeMillis()-now)/1000.0));
logger.info("initial threshold: " + initialThreshold); logger.info("initial threshold: {}", initialThreshold);
logger.info("---------------------------------------------------------------------"); logger.info("---------------------------------------------------------------------");
} }

View file

@ -83,7 +83,7 @@ public class SchrimpfAcceptance implements SolutionAcceptor, IterationStartsList
public SchrimpfAcceptance(int solutionMemory, double alpha){ public SchrimpfAcceptance(int solutionMemory, double alpha){
this.alpha = alpha; this.alpha = alpha;
this.solutionMemory = solutionMemory; this.solutionMemory = solutionMemory;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@Override @Override

View file

@ -67,7 +67,7 @@ public class SchrimpfInitialThresholdGenerator implements AlgorithmStartsListene
@Override @Override
public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) { public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
double result = Solutions.bestOf(solutions).getCost(); double result = Solutions.bestOf(solutions).getCost();
// logger.info("result="+result); // logger.info("result={}", result);
results[iteration-1] = result; results[iteration-1] = result;
} }
@ -80,8 +80,8 @@ public class SchrimpfInitialThresholdGenerator implements AlgorithmStartsListene
schrimpfAcceptance.setInitialThreshold(initialThreshold); schrimpfAcceptance.setInitialThreshold(initialThreshold);
logger.info("took " + ((System.currentTimeMillis()-now)/1000.0) + " seconds"); logger.info("took {} seconds", ((System.currentTimeMillis()-now)/1000.0) );
logger.debug("initial threshold: " + initialThreshold); logger.debug("initial threshold: {}", initialThreshold);
logger.info("---------------------------------------------------------------------"); logger.info("---------------------------------------------------------------------");
} }

View file

@ -110,7 +110,7 @@ public abstract class AbstractInsertionStrategy implements InsertionStrategy{
} }
protected void insertJob(Job unassignedJob, InsertionData iData, VehicleRoute inRoute){ protected void insertJob(Job unassignedJob, InsertionData iData, VehicleRoute inRoute){
logger.trace("insert: [jobId=" + unassignedJob.getId() + "]" + iData ); logger.trace("insert: [jobId={}]{}", unassignedJob.getId(), iData);
insertionsListeners.informBeforeJobInsertion(unassignedJob, iData, inRoute); insertionsListeners.informBeforeJobInsertion(unassignedJob, iData, inRoute);
if(!(inRoute.getVehicle().getId().equals(iData.getSelectedVehicle().getId()))){ if(!(inRoute.getVehicle().getId().equals(iData.getSelectedVehicle().getId()))){
insertionsListeners.informVehicleSwitched(inRoute, inRoute.getVehicle(), iData.getSelectedVehicle()); insertionsListeners.informVehicleSwitched(inRoute, inRoute.getVehicle(), iData.getSelectedVehicle());

View file

@ -56,7 +56,7 @@ public final class BestInsertion extends AbstractInsertionStrategy{
public BestInsertion(JobInsertionCostsCalculator jobInsertionCalculator, VehicleRoutingProblem vehicleRoutingProblem) { public BestInsertion(JobInsertionCostsCalculator jobInsertionCalculator, VehicleRoutingProblem vehicleRoutingProblem) {
super(vehicleRoutingProblem); super(vehicleRoutingProblem);
bestInsertionCostCalculator = jobInsertionCalculator; bestInsertionCostCalculator = jobInsertionCalculator;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@Override @Override

View file

@ -94,7 +94,7 @@ public final class BestInsertionConcurrent extends AbstractInsertionStrategy{
this.nuOfBatches = nuOfBatches; this.nuOfBatches = nuOfBatches;
bestInsertionCostCalculator = jobInsertionCalculator; bestInsertionCostCalculator = jobInsertionCalculator;
completionService = new ExecutorCompletionService<Insertion>(executorService); completionService = new ExecutorCompletionService<Insertion>(executorService);
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@Override @Override
@ -136,7 +136,7 @@ public final class BestInsertionConcurrent extends AbstractInsertionStrategy{
} }
catch (ExecutionException e) { catch (ExecutionException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e.getCause().toString()); logger.error("Exception", e);
System.exit(1); System.exit(1);
} }
VehicleRoute newRoute = VehicleRoute.emptyRoute(); VehicleRoute newRoute = VehicleRoute.emptyRoute();

View file

@ -46,7 +46,7 @@ final class JobInsertionConsideringFixCostsCalculator implements JobInsertionCos
super(); super();
this.standardServiceInsertion = standardInsertionCalculator; this.standardServiceInsertion = standardInsertionCalculator;
this.stateGetter = stateGetter; this.stateGetter = stateGetter;
logger.debug("inialise " + this); logger.debug("inialise {}", this);
} }
@Override @Override
@ -77,7 +77,7 @@ final class JobInsertionConsideringFixCostsCalculator implements JobInsertionCos
public void setWeightOfFixCost(double weight){ public void setWeightOfFixCost(double weight){
weight_deltaFixCost = weight; weight_deltaFixCost = weight;
logger.debug("set weightOfFixCostSaving to " + weight); logger.debug("set weightOfFixCostSaving to {}", weight);
} }
@Override @Override

View file

@ -203,7 +203,7 @@ public class RegretInsertion extends AbstractInsertionStrategy {
this.scoringFunction = new DefaultScorer(vehicleRoutingProblem); this.scoringFunction = new DefaultScorer(vehicleRoutingProblem);
this.insertionCostsCalculator = jobInsertionCalculator; this.insertionCostsCalculator = jobInsertionCalculator;
this.vrp = vehicleRoutingProblem; this.vrp = vehicleRoutingProblem;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@Override @Override

View file

@ -144,7 +144,7 @@ public class RegretInsertionConcurrent extends AbstractInsertionStrategy {
} }
catch (ExecutionException e) { catch (ExecutionException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e.getCause().toString()); logger.error("Exception", e);
System.exit(1); System.exit(1);
} }

View file

@ -70,7 +70,7 @@ final class ServiceInsertionCalculator implements JobInsertionCostsCalculator{
softRouteConstraint = constraintManager; softRouteConstraint = constraintManager;
this.additionalTransportCostsCalculator = additionalTransportCostsCalculator; this.additionalTransportCostsCalculator = additionalTransportCostsCalculator;
additionalAccessEgressCalculator = new AdditionalAccessEgressCalculator(routingCosts); additionalAccessEgressCalculator = new AdditionalAccessEgressCalculator(routingCosts);
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
public void setJobActivityFactory(JobActivityFactory jobActivityFactory){ public void setJobActivityFactory(JobActivityFactory jobActivityFactory){

View file

@ -81,7 +81,7 @@ final class ServiceInsertionOnRouteLevelCalculator implements JobInsertionCostsC
public void setMemorySize(int memorySize) { public void setMemorySize(int memorySize) {
this.memorySize = memorySize; this.memorySize = memorySize;
logger.debug("set [solutionMemory="+memorySize+"]"); logger.debug("set [solutionMemory={}]", memorySize);
} }
public ServiceInsertionOnRouteLevelCalculator(VehicleRoutingTransportCosts vehicleRoutingCosts, VehicleRoutingActivityCosts costFunc, ActivityInsertionCostsCalculator activityInsertionCostsCalculator, HardRouteConstraint hardRouteLevelConstraint, HardActivityConstraint hardActivityLevelConstraint) { public ServiceInsertionOnRouteLevelCalculator(VehicleRoutingTransportCosts vehicleRoutingCosts, VehicleRoutingActivityCosts costFunc, ActivityInsertionCostsCalculator activityInsertionCostsCalculator, HardRouteConstraint hardRouteLevelConstraint, HardActivityConstraint hardActivityLevelConstraint) {
@ -92,7 +92,7 @@ final class ServiceInsertionOnRouteLevelCalculator implements JobInsertionCostsC
this.hardRouteLevelConstraint = hardRouteLevelConstraint; this.hardRouteLevelConstraint = hardRouteLevelConstraint;
this.hardActivityLevelConstraint = hardActivityLevelConstraint; this.hardActivityLevelConstraint = hardActivityLevelConstraint;
auxilliaryPathCostCalculator = new AuxilliaryCostCalculator(transportCosts, activityCosts); auxilliaryPathCostCalculator = new AuxilliaryCostCalculator(transportCosts, activityCosts);
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@ -102,7 +102,7 @@ final class ServiceInsertionOnRouteLevelCalculator implements JobInsertionCostsC
void setNuOfActsForwardLooking(int nOfActsForwardLooking) { void setNuOfActsForwardLooking(int nOfActsForwardLooking) {
this.nuOfActsForwardLooking = nOfActsForwardLooking; this.nuOfActsForwardLooking = nOfActsForwardLooking;
logger.debug("set [forwardLooking="+nOfActsForwardLooking+"]"); logger.debug("set [forwardLooking={}]", nOfActsForwardLooking);
} }
@Override @Override

View file

@ -68,7 +68,7 @@ final class ShipmentInsertionCalculator implements JobInsertionCostsCalculator{
this.softRouteConstraint = constraintManager; this.softRouteConstraint = constraintManager;
this.transportCosts = routingCosts; this.transportCosts = routingCosts;
additionalAccessEgressCalculator = new AdditionalAccessEgressCalculator(routingCosts); additionalAccessEgressCalculator = new AdditionalAccessEgressCalculator(routingCosts);
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
public void setJobActivityFactory(JobActivityFactory activityFactory){ public void setJobActivityFactory(JobActivityFactory activityFactory){
@ -136,7 +136,7 @@ final class ShipmentInsertionCalculator implements JobInsertionCostsCalculator{
nextAct = end; nextAct = end;
tourEnd = true; tourEnd = true;
} }
// logger.info("activity: " + i + ", act-size: " + activities.size()); // logger.info("activity: {}, act-size: {}", i, activities.size());
ConstraintsStatus pickupShipmentConstraintStatus = hardActivityLevelConstraint.fulfilled(insertionContext, prevAct, pickupShipment, nextAct, prevActEndTime); ConstraintsStatus pickupShipmentConstraintStatus = hardActivityLevelConstraint.fulfilled(insertionContext, prevAct, pickupShipment, nextAct, prevActEndTime);
if(pickupShipmentConstraintStatus.equals(ConstraintsStatus.NOT_FULFILLED)){ if(pickupShipmentConstraintStatus.equals(ConstraintsStatus.NOT_FULFILLED)){
double nextActArrTime = prevActEndTime + transportCosts.getTransportTime(prevAct.getLocation(), nextAct.getLocation(), prevActEndTime, newDriver, newVehicle); double nextActArrTime = prevActEndTime + transportCosts.getTransportTime(prevAct.getLocation(), nextAct.getLocation(), prevActEndTime, newDriver, newVehicle);

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.debug("initialise " + this); logger.debug("initialise {}", this);
} }
private void getInitialVehicleIds() { private void getInitialVehicleIds() {
@ -89,7 +89,7 @@ final class VehicleTypeDependentJobInsertionCalculator implements JobInsertionCo
* @param vehicleSwitchAllowed the vehicleSwitchAllowed to set * @param vehicleSwitchAllowed the vehicleSwitchAllowed to set
*/ */
public void setVehicleSwitchAllowed(boolean vehicleSwitchAllowed) { public void setVehicleSwitchAllowed(boolean vehicleSwitchAllowed) {
logger.debug("set vehicleSwitchAllowed to " + vehicleSwitchAllowed); logger.debug("set vehicleSwitchAllowed to {}", vehicleSwitchAllowed);
this.vehicleSwitchAllowed = vehicleSwitchAllowed; this.vehicleSwitchAllowed = vehicleSwitchAllowed;
} }

View file

@ -63,7 +63,7 @@ public abstract class AbstractRuinStrategy implements RuinStrategy{
public Collection<Job> ruin(Collection<VehicleRoute> vehicleRoutes){ public Collection<Job> ruin(Collection<VehicleRoute> vehicleRoutes){
ruinListeners.ruinStarts(vehicleRoutes); ruinListeners.ruinStarts(vehicleRoutes);
Collection<Job> unassigned = ruinRoutes(vehicleRoutes); Collection<Job> unassigned = ruinRoutes(vehicleRoutes);
logger.trace("ruin: " + "[ruined=" + unassigned.size() + "]"); logger.trace("ruin: [ruined={}]", unassigned.size());
ruinListeners.ruinEnds(vehicleRoutes,unassigned); ruinListeners.ruinEnds(vehicleRoutes,unassigned);
return unassigned; return unassigned;
} }
@ -116,7 +116,7 @@ public abstract class AbstractRuinStrategy implements RuinStrategy{
if(jobIsInitial(job)) return false; if(jobIsInitial(job)) return false;
boolean removed = route.getTourActivities().removeJob(job); boolean removed = route.getTourActivities().removeJob(job);
if (removed) { if (removed) {
logger.trace("ruin: " + job.getId()); logger.trace("ruin: {}", job.getId());
ruinListeners.removed(job,route); ruinListeners.removed(job,route);
return true; return true;
} }

View file

@ -26,7 +26,7 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
super(); super();
this.vrp = vrp; this.vrp = vrp;
this.jobDistance = jobDistance; this.jobDistance = jobDistance;
logger.debug("intialise " + this); logger.debug("intialise {}", this);
} }
@Override @Override
@ -86,8 +86,8 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
} }
stopWatch.stop(); stopWatch.stop();
logger.debug("preprocessing comp-time: " + stopWatch + "; nuOfDistances stored: " + nuOfDistancesStored + "; estimated memory: " + logger.debug("preprocessing comp-time: {}; nuOfDistances stored: {}; estimated memory: {}" +
(distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) + " bytes"); " bytes", stopWatch, nuOfDistancesStored, (distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) );
} }
} }

View file

@ -29,7 +29,7 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
this.vrp = vrp; this.vrp = vrp;
this.jobDistance = jobDistance; this.jobDistance = jobDistance;
this.capacity = capacity; this.capacity = capacity;
logger.debug("intialise " + this); logger.debug("intialise {}", this);
} }
@Override @Override
@ -59,7 +59,7 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
@Override @Override
public void initialise(){ public void initialise(){
logger.debug("calculates distances from EACH job to EACH job --> n^2="+Math.pow(vrp.getJobs().values().size(), 2) + " calculations, but 'only' "+(vrp.getJobs().values().size()*capacity)+ " are cached."); logger.debug("calculates distances from EACH job to EACH job --> n^2={} calculations, but 'only' {} are cached.", Math.pow(vrp.getJobs().values().size(), 2), (vrp.getJobs().values().size()*capacity));
if(capacity==0) return; if(capacity==0) return;
calculateDistancesFromJob2Job(); calculateDistancesFromJob2Job();
} }
@ -101,8 +101,8 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
} }
stopWatch.stop(); stopWatch.stop();
logger.debug("preprocessing comp-time: " + stopWatch + "; nuOfDistances stored: " + nuOfDistancesStored + "; estimated memory: " + logger.debug("preprocessing comp-time: {}; nuOfDistances stored: {}; estimated memory: {}" +
(distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) + " bytes"); " bytes", stopWatch, nuOfDistancesStored, (distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92));
} }
@Override @Override

View file

@ -87,7 +87,7 @@ public final class RuinClusters extends AbstractRuinStrategy implements Iteratio
} }
}); });
this.jobNeighborhoods = jobNeighborhoods; this.jobNeighborhoods = jobNeighborhoods;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
public void setNoClusters(int noClusters) { public void setNoClusters(int noClusters) {

View file

@ -68,7 +68,7 @@ public final class RuinRadial extends AbstractRuinStrategy {
JobNeighborhoodsImplWithCapRestriction jobNeighborhoodsImpl = new JobNeighborhoodsImplWithCapRestriction(vrp, jobDistance, noJobsToMemorize); JobNeighborhoodsImplWithCapRestriction jobNeighborhoodsImpl = new JobNeighborhoodsImplWithCapRestriction(vrp, jobDistance, noJobsToMemorize);
jobNeighborhoodsImpl.initialise(); jobNeighborhoodsImpl.initialise();
jobNeighborhoods = jobNeighborhoodsImpl; jobNeighborhoods = jobNeighborhoodsImpl;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
public RuinRadial(VehicleRoutingProblem vrp, int noJobs2beRemoved, JobDistance jobDistance) { public RuinRadial(VehicleRoutingProblem vrp, int noJobs2beRemoved, JobDistance jobDistance) {
@ -87,7 +87,7 @@ public final class RuinRadial extends AbstractRuinStrategy {
JobNeighborhoodsImplWithCapRestriction jobNeighborhoodsImpl = new JobNeighborhoodsImplWithCapRestriction(vrp, jobDistance, noJobsToMemorize); JobNeighborhoodsImplWithCapRestriction jobNeighborhoodsImpl = new JobNeighborhoodsImplWithCapRestriction(vrp, jobDistance, noJobsToMemorize);
jobNeighborhoodsImpl.initialise(); jobNeighborhoodsImpl.initialise();
jobNeighborhoods = jobNeighborhoodsImpl; jobNeighborhoods = jobNeighborhoodsImpl;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
public RuinRadial(VehicleRoutingProblem vrp, int noJobs2beRemoved, JobNeighborhoods neighborhoods) { public RuinRadial(VehicleRoutingProblem vrp, int noJobs2beRemoved, JobNeighborhoods neighborhoods) {
@ -103,7 +103,7 @@ public final class RuinRadial extends AbstractRuinStrategy {
}; };
jobNeighborhoods = neighborhoods; jobNeighborhoods = neighborhoods;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@Override @Override

View file

@ -62,7 +62,7 @@ public final class RuinRadialMultipleCenters extends AbstractRuinStrategy {
JobNeighborhoodsImplWithCapRestriction jobNeighborhoodsImpl = new JobNeighborhoodsImplWithCapRestriction(vrp, jobDistance, noJobsToMemorize); JobNeighborhoodsImplWithCapRestriction jobNeighborhoodsImpl = new JobNeighborhoodsImplWithCapRestriction(vrp, jobDistance, noJobsToMemorize);
jobNeighborhoodsImpl.initialise(); jobNeighborhoodsImpl.initialise();
jobNeighborhoods = jobNeighborhoodsImpl; jobNeighborhoods = jobNeighborhoodsImpl;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
public void setNumberOfRuinCenters(int noCenters){ public void setNumberOfRuinCenters(int noCenters){

View file

@ -60,7 +60,7 @@ public final class RuinRandom extends AbstractRuinStrategy {
return selectNuOfJobs2BeRemoved(); return selectNuOfJobs2BeRemoved();
} }
}); });
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
/** /**

View file

@ -64,7 +64,7 @@ public final class RuinWorst extends AbstractRuinStrategy {
return initialNumberJobsToRemove; return initialNumberJobsToRemove;
} }
}); });
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
/** /**

View file

@ -70,7 +70,7 @@ public class TimeTermination implements PrematureAlgorithmTermination, Algorithm
public TimeTermination(long timeThreshold_in_milliseconds) { public TimeTermination(long timeThreshold_in_milliseconds) {
super(); super();
this.timeThreshold = timeThreshold_in_milliseconds; this.timeThreshold = timeThreshold_in_milliseconds;
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
public void setTimeGetter(TimeGetter timeGetter) { public void setTimeGetter(TimeGetter timeGetter) {

View file

@ -73,7 +73,7 @@ public class VariationCoefficientTermination implements PrematureAlgorithmTermin
this.noIterations = noIterations; this.noIterations = noIterations;
this.variationCoefficientThreshold = variationCoefficientThreshold; this.variationCoefficientThreshold = variationCoefficientThreshold;
solutionValues = new double[noIterations]; solutionValues = new double[noIterations];
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@Override @Override

View file

@ -321,7 +321,7 @@ public class VehicleRoutingProblem {
} }
private void addShipment(Shipment job) { private void addShipment(Shipment job) {
if(jobs.containsKey(job.getId())){ logger.warn("job " + job + " already in job list. overrides existing job."); } if(jobs.containsKey(job.getId())){ logger.warn("job {} already in job list. overrides existing job.", job); }
tentative_coordinates.put(job.getPickupLocation().getId(), job.getPickupLocation().getCoordinate()); tentative_coordinates.put(job.getPickupLocation().getId(), job.getPickupLocation().getCoordinate());
tentative_coordinates.put(job.getDeliveryLocation().getId(), job.getDeliveryLocation().getCoordinate()); tentative_coordinates.put(job.getDeliveryLocation().getId(), job.getDeliveryLocation().getCoordinate());
jobs.put(job.getId(),job); jobs.put(job.getId(),job);
@ -472,7 +472,7 @@ public class VehicleRoutingProblem {
private Builder addService(Service service){ private Builder addService(Service service){
tentative_coordinates.put(service.getLocation().getId(), service.getLocation().getCoordinate()); tentative_coordinates.put(service.getLocation().getId(), service.getLocation().getCoordinate());
if(jobs.containsKey(service.getId())){ logger.warn("service " + service + " already in job list. overrides existing job."); } if(jobs.containsKey(service.getId())){ logger.warn("service {} already in job list. overrides existing job.", service); }
jobs.put(service.getId(),service); jobs.put(service.getId(),service);
return this; return this;
} }
@ -554,7 +554,7 @@ public class VehicleRoutingProblem {
this.locations = builder.getLocations(); this.locations = builder.getLocations();
this.activityMap = builder.activityMap; this.activityMap = builder.activityMap;
this.nuActivities = builder.activityIndexCounter; this.nuActivities = builder.activityIndexCounter;
logger.info("setup problem: " + this); logger.info("setup problem: {}", this);
} }
@Override @Override

View file

@ -137,7 +137,7 @@ public class VrpXMLReader{
} }
public void read(String filename) { public void read(String filename) {
logger.debug("read vrp: " + filename); logger.debug("read vrp: {}", filename);
XMLConfiguration xmlConfig = new XMLConfiguration(); XMLConfiguration xmlConfig = new XMLConfiguration();
xmlConfig.setFileName(filename); xmlConfig.setFileName(filename);
xmlConfig.setAttributeSplittingDisabled(true); xmlConfig.setAttributeSplittingDisabled(true);
@ -166,7 +166,7 @@ public class VrpXMLReader{
try { try {
xmlConfig.load(); xmlConfig.load();
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
logger.error(e); logger.error("Exception:", e);
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(1);
} }

View file

@ -117,7 +117,7 @@ public class VrpXMLWriter {
element.setAttribute("xsi:schemaLocation","http://www.w3schools.com vrp_xml_schema.xsd"); element.setAttribute("xsi:schemaLocation","http://www.w3schools.com vrp_xml_schema.xsd");
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
logger.error(e); logger.error("Exception:", e);
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(1);
} }
@ -128,7 +128,7 @@ public class VrpXMLWriter {
serializer.serialize(xmlConfig.getDocument()); serializer.serialize(xmlConfig.getDocument());
out.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
logger.error(e); logger.error("Exception:", e);
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(1);
} }

View file

@ -37,7 +37,7 @@ class InfiniteVehicles implements VehicleFleetManager{
public InfiniteVehicles(Collection<Vehicle> vehicles){ public InfiniteVehicles(Collection<Vehicle> vehicles){
extractTypes(vehicles); extractTypes(vehicles);
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@Override @Override

View file

@ -76,7 +76,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
this.vehicles = vehicles; this.vehicles = vehicles;
this.lockedVehicles = new HashSet<Vehicle>(); this.lockedVehicles = new HashSet<Vehicle>();
makeMap(); makeMap();
logger.debug("initialise " + this); logger.debug("initialise {}", this);
} }
@Override @Override

View file

@ -111,7 +111,7 @@ public class ChristofidesReader {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
} }
} }
@ -121,7 +121,7 @@ public class ChristofidesReader {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
return null; return null;
} }
@ -139,7 +139,7 @@ public class ChristofidesReader {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); e1.printStackTrace();
logger.error(e1); logger.error("Exception:", e1);
System.exit(1); System.exit(1);
} }
return reader; return reader;

View file

@ -141,7 +141,7 @@ public class CordeauReader {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
} }
} }
@ -151,7 +151,7 @@ public class CordeauReader {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
return null; return null;
} }
@ -169,7 +169,7 @@ public class CordeauReader {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); e1.printStackTrace();
logger.error(e1); logger.error("Exception:", e1);
System.exit(1); System.exit(1);
} }
return reader; return reader;

View file

@ -142,7 +142,7 @@ public class LiLimReader {
reader = new BufferedReader(new FileReader(file)); reader = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); e1.printStackTrace();
logger.error(e1); logger.error("Exception:", e1);
System.exit(1); System.exit(1);
} }
return reader; return reader;

View file

@ -90,7 +90,7 @@ public class LopezIbanezBlumReader {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
} }
} }
@ -100,7 +100,7 @@ public class LopezIbanezBlumReader {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
return null; return null;
} }
@ -112,7 +112,7 @@ public class LopezIbanezBlumReader {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); e1.printStackTrace();
logger.error(e1); logger.error("Exception:", e1);
System.exit(1); System.exit(1);
} }
return reader; return reader;

View file

@ -154,7 +154,7 @@ public class LuiShenReader {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
} }
} }
@ -164,7 +164,7 @@ public class LuiShenReader {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
return null; return null;
} }
@ -182,7 +182,7 @@ public class LuiShenReader {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); e1.printStackTrace();
logger.error(e1); logger.error("Exception:", e1);
System.exit(1); System.exit(1);
} }
return reader; return reader;

View file

@ -130,7 +130,7 @@ public class SolomonReader {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
} }
} }
@ -140,7 +140,7 @@ public class SolomonReader {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.error(e); logger.error("Exception:", e);
System.exit(1); System.exit(1);
return null; return null;
} }
@ -158,7 +158,7 @@ public class SolomonReader {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); e1.printStackTrace();
logger.error(e1); logger.error("Exception:", e1);
System.exit(1); System.exit(1);
} }
return reader; return reader;