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

improve logging - #159

This commit is contained in:
oblonski 2015-05-18 22:04:00 +02:00
parent bb5c763371
commit 56243f924e
37 changed files with 86 additions and 86 deletions

View file

@ -49,14 +49,13 @@ public final class InsertionInitialSolutionFactory implements InitialSolutionFac
@Override @Override
public VehicleRoutingProblemSolution createSolution(final VehicleRoutingProblem vrp) { public VehicleRoutingProblemSolution createSolution(final VehicleRoutingProblem vrp) {
logger.info("create initial solution."); logger.info("create initial solution");
List<VehicleRoute> vehicleRoutes = new ArrayList<VehicleRoute>(); List<VehicleRoute> vehicleRoutes = new ArrayList<VehicleRoute>();
vehicleRoutes.addAll(vrp.getInitialVehicleRoutes()); vehicleRoutes.addAll(vrp.getInitialVehicleRoutes());
Collection<Job> badJobs = insertion.insertJobs(vehicleRoutes, getUnassignedJobs(vrp)); Collection<Job> badJobs = insertion.insertJobs(vehicleRoutes, getUnassignedJobs(vrp));
VehicleRoutingProblemSolution solution = new VehicleRoutingProblemSolution(vehicleRoutes, badJobs, Double.MAX_VALUE); VehicleRoutingProblemSolution solution = new VehicleRoutingProblemSolution(vehicleRoutes, badJobs, Double.MAX_VALUE);
double costs = solutionCostsCalculator.getCosts(solution); double costs = solutionCostsCalculator.getCosts(solution);
solution.setCost(costs); solution.setCost(costs);
logger.info("creation done");
return solution; return solution;
} }

View file

@ -62,6 +62,10 @@ public class SearchStrategy {
public String getStrategyId() { return strategyId; } public String getStrategyId() { return strategyId; }
@Override
public String toString() {
return "[strategyId="+strategyId+"][solution="+solution+"][accepted="+accepted+"]";
}
} }
private static Logger logger = LogManager.getLogger(SearchStrategy.class); private static Logger logger = LogManager.getLogger(SearchStrategy.class);
@ -84,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.info("initialise " + this); logger.debug("initialise " + this);
} }
public String getId() { public String getId() {
@ -155,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.info("module added [module="+module+"][#modules="+searchStrategyModules.size()+"]"); logger.debug("module added [module=" + module + "][#modules=" + searchStrategyModules.size() + "]");
} }
public void addModuleListener(SearchStrategyModuleListener moduleListener) { public void addModuleListener(SearchStrategyModuleListener moduleListener) {

View file

@ -19,12 +19,16 @@ package jsprit.core.algorithm;
import jsprit.core.algorithm.listener.SearchStrategyListener; import jsprit.core.algorithm.listener.SearchStrategyListener;
import jsprit.core.algorithm.listener.SearchStrategyModuleListener; import jsprit.core.algorithm.listener.SearchStrategyModuleListener;
import jsprit.core.util.RandomNumberGeneration; import jsprit.core.util.RandomNumberGeneration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.*; import java.util.*;
public class SearchStrategyManager { public class SearchStrategyManager {
private final static Logger logger = LogManager.getLogger();
private List<SearchStrategyListener> searchStrategyListeners = new ArrayList<SearchStrategyListener>(); private List<SearchStrategyListener> searchStrategyListeners = new ArrayList<SearchStrategyListener>();
private List<SearchStrategy> strategies = new ArrayList<SearchStrategy>(); private List<SearchStrategy> strategies = new ArrayList<SearchStrategy>();

View file

@ -83,7 +83,7 @@ public class VehicleRoutingAlgorithm {
} }
} }
private final static Logger logger = LogManager.getLogger(VehicleRoutingAlgorithm.class); private final static Logger logger = LogManager.getLogger();
private final Counter counter = new Counter("iterations "); private final Counter counter = new Counter("iterations ");
@ -188,8 +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("------------------------------------------------"); logger.info("algorithm starts: " + "[maxIterations=" + maxIterations + "]");
logger.info("algorithm starts");
double now = System.currentTimeMillis(); double now = System.currentTimeMillis();
int noIterationsThisAlgoIsRunning = maxIterations; int noIterationsThisAlgoIsRunning = maxIterations;
counter.reset(); counter.reset();
@ -199,9 +198,11 @@ 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);
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);
memorizeIfBestEver(discoveredSolution); memorizeIfBestEver(discoveredSolution);
selectedStrategy(discoveredSolution,problem,solutions); selectedStrategy(discoveredSolution,problem,solutions);
if(terminationManager.isPrematureBreak(discoveredSolution)){ if(terminationManager.isPrematureBreak(discoveredSolution)){
@ -214,9 +215,7 @@ public class VehicleRoutingAlgorithm {
logger.info("iterations end at " + noIterationsThisAlgoIsRunning + " iterations"); logger.info("iterations end at " + noIterationsThisAlgoIsRunning + " iterations");
addBestEver(solutions); addBestEver(solutions);
algorithmEnds(problem, solutions); algorithmEnds(problem, solutions);
logger.info("total time: " + ((System.currentTimeMillis()-now)/1000.0) + "s"); logger.info("took " + ((System.currentTimeMillis()-now)/1000.0) + " seconds");
logger.info("done");
logger.info("------------------------------------------------");
return solutions; return solutions;
} }
@ -268,7 +267,7 @@ public class VehicleRoutingAlgorithm {
*/ */
public void setMaxIterations(int maxIterations) { public void setMaxIterations(int maxIterations) {
this.maxIterations = maxIterations; this.maxIterations = maxIterations;
logger.info("set maxIterations to " + this.maxIterations); logger.debug("set maxIterations to " + this.maxIterations);
} }
/** /**

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.info("initialise " + this); logger.debug("initialise " + this);
} }
@Override @Override

View file

@ -49,9 +49,7 @@ public class SchrimpfInitialThresholdGenerator implements AlgorithmStartsListene
@Override @Override
public void informAlgorithmStarts(VehicleRoutingProblem problem,VehicleRoutingAlgorithm algorithm,Collection<VehicleRoutingProblemSolution> solutions) { public void informAlgorithmStarts(VehicleRoutingProblem problem,VehicleRoutingAlgorithm algorithm,Collection<VehicleRoutingProblemSolution> solutions) {
logger.info("---------------------------------------------------------------------");
logger.info("prepare schrimpfAcceptanceFunction, i.e. determine initial threshold"); logger.info("prepare schrimpfAcceptanceFunction, i.e. determine initial threshold");
logger.info("start random-walk (see randomWalk.xml)");
double now = System.currentTimeMillis(); double now = System.currentTimeMillis();
/* /*
@ -82,9 +80,8 @@ public class SchrimpfInitialThresholdGenerator implements AlgorithmStartsListene
schrimpfAcceptance.setInitialThreshold(initialThreshold); schrimpfAcceptance.setInitialThreshold(initialThreshold);
logger.info("warmup done"); logger.info("took " + ((System.currentTimeMillis()-now)/1000.0) + " seconds");
logger.info("total time: " + ((System.currentTimeMillis()-now)/1000.0) + "s"); logger.debug("initial threshold: " + initialThreshold);
logger.info("initial threshold: " + initialThreshold);
logger.info("---------------------------------------------------------------------"); logger.info("---------------------------------------------------------------------");
} }

View file

@ -50,7 +50,7 @@ public class AlgorithmConfigXmlReader {
} }
public void read(URL url){ public void read(URL url){
log.info("read algorithm-config from file " + url); log.debug("read algorithm: " + url);
algorithmConfig.getXMLConfiguration().setURL(url); algorithmConfig.getXMLConfiguration().setURL(url);
algorithmConfig.getXMLConfiguration().setAttributeSplittingDisabled(true); algorithmConfig.getXMLConfiguration().setAttributeSplittingDisabled(true);
algorithmConfig.getXMLConfiguration().setDelimiterParsingDisabled(true); algorithmConfig.getXMLConfiguration().setDelimiterParsingDisabled(true);
@ -70,7 +70,6 @@ public class AlgorithmConfigXmlReader {
}; };
algorithmConfig.getXMLConfiguration().setEntityResolver(resolver); algorithmConfig.getXMLConfiguration().setEntityResolver(resolver);
algorithmConfig.getXMLConfiguration().setSchemaValidation(true); algorithmConfig.getXMLConfiguration().setSchemaValidation(true);
log.info("validating " + url + " with xsd-schema");
} }
else{ else{
log.warn("cannot find schema-xsd file (algorithm_xml_schema.xsd). try to read xml without xml-file-validation."); log.warn("cannot find schema-xsd file (algorithm_xml_schema.xsd). try to read xml without xml-file-validation.");
@ -87,7 +86,7 @@ public class AlgorithmConfigXmlReader {
public void read(String filename){ public void read(String filename){
log.info("read algorithm-config from file " + filename); log.debug("read algorithm-config from file " + filename);
URL url = Resource.getAsURL(filename); URL url = Resource.getAsURL(filename);
read(url); read(url);
} }

View file

@ -503,13 +503,13 @@ public class VehicleRoutingAlgorithms {
//threading //threading
final ExecutorService executorService; final ExecutorService executorService;
if(nuOfThreads > 0){ if(nuOfThreads > 0){
log.info("setup executor-service with " + nuOfThreads + " threads"); log.debug("setup executor-service with " + nuOfThreads + " threads");
executorService = Executors.newFixedThreadPool(nuOfThreads); executorService = Executors.newFixedThreadPool(nuOfThreads);
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, new AlgorithmEndsListener() { algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, new AlgorithmEndsListener() {
@Override @Override
public void informAlgorithmEnds(VehicleRoutingProblem problem,Collection<VehicleRoutingProblemSolution> solutions) { public void informAlgorithmEnds(VehicleRoutingProblem problem,Collection<VehicleRoutingProblemSolution> solutions) {
log.info("shutdown executor-service"); log.debug("shutdown executor-service");
executorService.shutdown(); executorService.shutdown();
} }
})); }));
@ -645,18 +645,18 @@ public class VehicleRoutingAlgorithms {
private static PrematureAlgorithmTermination getTerminationCriterion(HierarchicalConfiguration config, Set<PrioritizedVRAListener> algorithmListeners) { private static PrematureAlgorithmTermination getTerminationCriterion(HierarchicalConfiguration config, Set<PrioritizedVRAListener> algorithmListeners) {
String basedOn = config.getString("[@basedOn]"); String basedOn = config.getString("[@basedOn]");
if(basedOn == null){ if(basedOn == null){
log.info("set default prematureBreak, i.e. no premature break at all."); log.debug("set default prematureBreak, i.e. no premature break at all.");
return null; return null;
} }
if(basedOn.equals("iterations")){ if(basedOn.equals("iterations")){
log.info("set prematureBreak based on iterations"); log.debug("set prematureBreak based on iterations");
String iter = config.getString("iterations"); String iter = config.getString("iterations");
if(iter == null) throw new IllegalStateException("iterations is missing"); if(iter == null) throw new IllegalStateException("iterations is missing");
int iterations = Integer.valueOf(iter); int iterations = Integer.valueOf(iter);
return new IterationWithoutImprovementTermination(iterations); return new IterationWithoutImprovementTermination(iterations);
} }
if(basedOn.equals("time")){ if(basedOn.equals("time")){
log.info("set prematureBreak based on time"); log.debug("set prematureBreak based on time");
String timeString = config.getString("time"); String timeString = config.getString("time");
if(timeString == null) throw new IllegalStateException("time is missing"); if(timeString == null) throw new IllegalStateException("time is missing");
long time = Long.parseLong(timeString); long time = Long.parseLong(timeString);
@ -665,7 +665,7 @@ public class VehicleRoutingAlgorithms {
return timeBreaker; return timeBreaker;
} }
if(basedOn.equals("variationCoefficient")){ if(basedOn.equals("variationCoefficient")){
log.info("set prematureBreak based on variation coefficient"); log.debug("set prematureBreak based on variation coefficient");
String thresholdString = config.getString("threshold"); String thresholdString = config.getString("threshold");
String iterationsString = config.getString("iterations"); String iterationsString = config.getString("iterations");
if(thresholdString == null) throw new IllegalStateException("threshold is missing"); if(thresholdString == null) throw new IllegalStateException("threshold is missing");
@ -682,18 +682,18 @@ public class VehicleRoutingAlgorithms {
private static PrematureAlgorithmTermination getPrematureTermination(XMLConfiguration config, Set<PrioritizedVRAListener> algorithmListeners) { private static PrematureAlgorithmTermination getPrematureTermination(XMLConfiguration config, Set<PrioritizedVRAListener> algorithmListeners) {
String basedOn = config.getString("prematureBreak[@basedOn]"); String basedOn = config.getString("prematureBreak[@basedOn]");
if(basedOn == null){ if(basedOn == null){
log.info("set default prematureBreak, i.e. no premature break at all."); log.debug("set default prematureBreak, i.e. no premature break at all.");
return null; return null;
} }
if(basedOn.equals("iterations")){ if(basedOn.equals("iterations")){
log.info("set prematureBreak based on iterations"); log.debug("set prematureBreak based on iterations");
String iter = config.getString("prematureBreak.iterations"); String iter = config.getString("prematureBreak.iterations");
if(iter == null) throw new IllegalStateException("prematureBreak.iterations is missing"); if(iter == null) throw new IllegalStateException("prematureBreak.iterations is missing");
int iterations = Integer.valueOf(iter); int iterations = Integer.valueOf(iter);
return new IterationWithoutImprovementTermination(iterations); return new IterationWithoutImprovementTermination(iterations);
} }
if(basedOn.equals("time")){ if(basedOn.equals("time")){
log.info("set prematureBreak based on time"); log.debug("set prematureBreak based on time");
String timeString = config.getString("prematureBreak.time"); String timeString = config.getString("prematureBreak.time");
if(timeString == null) throw new IllegalStateException("prematureBreak.time is missing"); if(timeString == null) throw new IllegalStateException("prematureBreak.time is missing");
long time = Long.parseLong(timeString); long time = Long.parseLong(timeString);
@ -702,7 +702,7 @@ public class VehicleRoutingAlgorithms {
return timeBreaker; return timeBreaker;
} }
if(basedOn.equals("variationCoefficient")){ if(basedOn.equals("variationCoefficient")){
log.info("set prematureBreak based on variation coefficient"); log.debug("set prematureBreak based on variation coefficient");
String thresholdString = config.getString("prematureBreak.threshold"); String thresholdString = config.getString("prematureBreak.threshold");
String iterationsString = config.getString("prematureBreak.iterations"); String iterationsString = config.getString("prematureBreak.iterations");
if(thresholdString == null) throw new IllegalStateException("prematureBreak.threshold is missing"); if(thresholdString == null) throw new IllegalStateException("prematureBreak.threshold is missing");

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.info("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.info("initialise " + this); logger.debug("initialise " + this);
} }
@Override @Override

View file

@ -55,7 +55,7 @@ class CalculatesServiceInsertionWithTimeScheduling implements JobInsertionCostsC
CalculatesServiceInsertionWithTimeScheduling(JobInsertionCostsCalculator jic, double t, double f) { CalculatesServiceInsertionWithTimeScheduling(JobInsertionCostsCalculator jic, double t, double f) {
super(); super();
this.jic = jic; this.jic = jic;
log.info("initialise " + this); log.debug("initialise " + this);
} }
@Override @Override

View file

@ -43,7 +43,7 @@ class CalculatesServiceInsertionWithTimeSchedulingInSlices implements JobInserti
this.jic = jic; this.jic = jic;
this.timeSlice = timeSlice; this.timeSlice = timeSlice;
this.nOfDepartureTimes = neighbors; this.nOfDepartureTimes = neighbors;
log.info("initialise " + this); log.debug("initialise " + this);
} }
@Override @Override

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.info("inialise " + this); logger.debug("inialise " + this);
} }
@Override @Override
@ -76,7 +76,7 @@ final class JobInsertionConsideringFixCostsCalculator implements JobInsertionCos
public void setWeightOfFixCost(double weight){ public void setWeightOfFixCost(double weight){
weight_deltaFixCost = weight; weight_deltaFixCost = weight;
logger.info("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.info("initialise " + this); logger.debug("initialise " + this);
} }
@Override @Override

View file

@ -70,7 +70,7 @@ public class RegretInsertionConcurrent extends AbstractInsertionStrategy {
this.insertionCostsCalculator = jobInsertionCalculator; this.insertionCostsCalculator = jobInsertionCalculator;
this.vrp = vehicleRoutingProblem; this.vrp = vehicleRoutingProblem;
completionService = new ExecutorCompletionService<ScoredJob>(executorService); completionService = new ExecutorCompletionService<ScoredJob>(executorService);
logger.info("initialise " + this); logger.debug("initialise " + this);
} }
@Override @Override

View file

@ -68,7 +68,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.info("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.info("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.info("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.info("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.info("initialise " + this); logger.debug("initialise " + this);
} }
public void setJobActivityFactory(JobActivityFactory activityFactory){ public void setJobActivityFactory(JobActivityFactory activityFactory){

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("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.info("set vehicleSwitchAllowed to " + vehicleSwitchAllowed); logger.debug("set vehicleSwitchAllowed to " + vehicleSwitchAllowed);
this.vehicleSwitchAllowed = vehicleSwitchAllowed; this.vehicleSwitchAllowed = vehicleSwitchAllowed;
} }

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.info("intialise " + this); logger.debug("intialise " + this);
} }
@Override @Override
@ -54,12 +54,12 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
@Override @Override
public void initialise(){ public void initialise(){
logger.info("calculates and memorizes distances from EACH job to EACH job --> n^2 calculations"); logger.debug("calculates and memorizes distances from EACH job to EACH job --> n^2 calculations");
calculateDistancesFromJob2Job(); calculateDistancesFromJob2Job();
} }
private void calculateDistancesFromJob2Job() { private void calculateDistancesFromJob2Job() {
logger.info("preprocess distances between locations ..."); logger.debug("preprocess distances between locations ...");
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
stopWatch.start(); stopWatch.start();
int nuOfDistancesStored = 0; int nuOfDistancesStored = 0;
@ -86,7 +86,7 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
} }
stopWatch.stop(); stopWatch.stop();
logger.info("preprocessing comp-time: " + stopWatch + "; nuOfDistances stored: " + nuOfDistancesStored + "; estimated memory: " + logger.debug("preprocessing comp-time: " + stopWatch + "; nuOfDistances stored: " + nuOfDistancesStored + "; estimated memory: " +
(distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) + " bytes"); (distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) + " bytes");
} }

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.info("intialise " + this); logger.debug("intialise " + this);
} }
@Override @Override
@ -59,13 +59,13 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
@Override @Override
public void initialise(){ public void initialise(){
logger.info("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="+Math.pow(vrp.getJobs().values().size(), 2) + " calculations, but 'only' "+(vrp.getJobs().values().size()*capacity)+ " are cached.");
if(capacity==0) return; if(capacity==0) return;
calculateDistancesFromJob2Job(); calculateDistancesFromJob2Job();
} }
private void calculateDistancesFromJob2Job() { private void calculateDistancesFromJob2Job() {
logger.info("preprocess distances between locations ..."); logger.debug("preprocess distances between locations ...");
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
stopWatch.start(); stopWatch.start();
int nuOfDistancesStored = 0; int nuOfDistancesStored = 0;
@ -101,7 +101,7 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
} }
stopWatch.stop(); stopWatch.stop();
logger.info("preprocessing comp-time: " + stopWatch + "; nuOfDistances stored: " + nuOfDistancesStored + "; estimated memory: " + logger.debug("preprocessing comp-time: " + stopWatch + "; nuOfDistances stored: " + nuOfDistancesStored + "; estimated memory: " +
(distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) + " bytes"); (distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) + " bytes");
} }

View file

@ -87,8 +87,7 @@ public final class RuinClusters extends AbstractRuinStrategy implements Iteratio
} }
}); });
this.jobNeighborhoods = jobNeighborhoods; this.jobNeighborhoods = jobNeighborhoods;
logger.info("initialise " + this); logger.debug("initialise " + this);
logger.info("done");
} }
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.info("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.info("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.info("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.info("initialise " + this); logger.debug("initialise " + this);
} }
public void setNumberOfRuinCenters(int noCenters){ public void setNumberOfRuinCenters(int noCenters){

View file

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

View file

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

View file

@ -45,7 +45,7 @@ public class IterationWithoutImprovementTermination implements PrematureAlgorith
*/ */
public IterationWithoutImprovementTermination(int noIterationsWithoutImprovement){ public IterationWithoutImprovementTermination(int noIterationsWithoutImprovement){
this.noIterationWithoutImprovement =noIterationsWithoutImprovement; this.noIterationWithoutImprovement =noIterationsWithoutImprovement;
log.info("initialise " + this); log.debug("initialise " + this);
} }
@Override @Override

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.info("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.info("initialise " + this); logger.debug("initialise " + this);
} }
@Override @Override

View file

@ -399,9 +399,7 @@ public class VehicleRoutingProblem {
* @return {@link VehicleRoutingProblem} * @return {@link VehicleRoutingProblem}
*/ */
public VehicleRoutingProblem build() { public VehicleRoutingProblem build() {
logger.info("build problem ...");
if(transportCosts == null){ if(transportCosts == null){
logger.warn("set routing costs crowFlyDistance.");
transportCosts = new CrowFlyCosts(getLocations()); transportCosts = new CrowFlyCosts(getLocations());
} }
for(Job job : tentativeJobs.values()) for(Job job : tentativeJobs.values())
@ -556,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("initialise " + 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.info("read vrp from file " + 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);
@ -158,10 +158,9 @@ public class VrpXMLReader{
}; };
xmlConfig.setEntityResolver(resolver); xmlConfig.setEntityResolver(resolver);
xmlConfig.setSchemaValidation(true); xmlConfig.setSchemaValidation(true);
logger.info("validating " + filename + " with xsd-schema");
} }
else{ else{
logger.warn("cannot find schema-xsd file (vrp_xml_schema.xsd). try to read xml without xml-file-validation."); logger.debug("cannot find schema-xsd file (vrp_xml_schema.xsd). try to read xml without xml-file-validation.");
} }
} }
try { try {
@ -617,7 +616,7 @@ public class VrpXMLReader{
} }
if(coordX == null || coordY == null) { if(coordX == null || coordY == null) {
if(!doNotWarnAgain) { if(!doNotWarnAgain) {
logger.warn("location.coord is missing. will not warn you again."); logger.debug("location.coord is missing. will not warn you again.");
doNotWarnAgain = true; doNotWarnAgain = true;
} }
} }
@ -644,7 +643,7 @@ public class VrpXMLReader{
String endCoordY = vehicleConfig.getString("endLocation.coord[@y]"); String endCoordY = vehicleConfig.getString("endLocation.coord[@y]");
if(endCoordX == null || endCoordY == null) { if(endCoordX == null || endCoordY == null) {
if(!doNotWarnAgain) { if(!doNotWarnAgain) {
logger.warn("endLocation.coord is missing. will not warn you again."); logger.debug("endLocation.coord is missing. will not warn you again.");
doNotWarnAgain = true; doNotWarnAgain = true;
} }
} }

View file

@ -80,7 +80,7 @@ public class VrpXMLWriter {
public void write(String filename){ public void write(String filename){
if(!filename.endsWith(".xml")) filename+=".xml"; if(!filename.endsWith(".xml")) filename+=".xml";
log.info("write vrp to " + filename); log.info("write vrp: " + filename);
XMLConf xmlConfig = new XMLConf(); XMLConf xmlConfig = new XMLConf();
xmlConfig.setFileName(filename); xmlConfig.setFileName(filename);
xmlConfig.setRootElementName("problem"); xmlConfig.setRootElementName("problem");

View file

@ -120,4 +120,8 @@ public class VehicleRoutingProblemSolution {
return unassignedJobs; return unassignedJobs;
} }
@Override
public String toString() {
return "[costs=" + cost + "][routes="+routes.size()+"][unassigned="+unassignedJobs.size()+"]";
}
} }

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.info("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.info("initialise " + this); logger.debug("initialise " + this);
} }
@Override @Override

View file

@ -41,16 +41,16 @@ public class Resource {
if (url != null) { if (url != null) {
return url; return url;
} }
log.info("Resource " + filename + " is unreachable by the current class loader, try the filesystem"); log.debug("resource: " + filename + " is unreachable by the current class loader, try the filesystem");
File file = new File(filename); File file = new File(filename);
if (!file.exists()) { if (!file.exists()) {
log.warn("Resource " + filename + " do not exists on the filesystem"); log.debug("resource: " + filename + " do not exists on the filesystem");
return null; return null;
} }
try { try {
return file.toURI().toURL(); return file.toURI().toURL();
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
log.warn("Resource " + filename + " exists on the filesystem, but its URL is invalid: " + e.getMessage()); log.debug("resource: " + filename + " exists on the filesystem, but its URL is invalid: " + e.getMessage());
return null; return null;
} }
} }
@ -60,16 +60,16 @@ public class Resource {
if (stream != null) { if (stream != null) {
return stream; return stream;
} }
log.info("Resource " + filename + " is unreachable by the current class loader, try the filesystem"); log.debug("resource: " + filename + " is unreachable by the current class loader, try the filesystem");
File file = new File(filename); File file = new File(filename);
if (!file.exists()) { if (!file.exists()) {
log.warn("Resource " + filename + " do not exists on the filesystem"); log.debug("resource: " + filename + " do not exists on the filesystem");
return null; return null;
} }
try { try {
return new FileInputStream(file); return new FileInputStream(file);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
log.warn("Resource " + filename + " exists on the filesystem, but its URL is invalid: " + e.getMessage()); log.debug("resource: " + filename + " exists on the filesystem, but its URL is invalid: " + e.getMessage());
return null; return null;
} }
} }

View file

@ -6,7 +6,7 @@
</Console> </Console>
</Appenders> </Appenders>
<Loggers> <Loggers>
<Root level="trace"> <Root level="info">
<AppenderRef ref="Console"/> <AppenderRef ref="Console"/>
</Root> </Root>
</Loggers> </Loggers>