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:
parent
bb5c763371
commit
56243f924e
37 changed files with 86 additions and 86 deletions
|
|
@ -49,14 +49,13 @@ public final class InsertionInitialSolutionFactory implements InitialSolutionFac
|
|||
|
||||
@Override
|
||||
public VehicleRoutingProblemSolution createSolution(final VehicleRoutingProblem vrp) {
|
||||
logger.info("create initial solution.");
|
||||
logger.info("create initial solution");
|
||||
List<VehicleRoute> vehicleRoutes = new ArrayList<VehicleRoute>();
|
||||
vehicleRoutes.addAll(vrp.getInitialVehicleRoutes());
|
||||
Collection<Job> badJobs = insertion.insertJobs(vehicleRoutes, getUnassignedJobs(vrp));
|
||||
VehicleRoutingProblemSolution solution = new VehicleRoutingProblemSolution(vehicleRoutes, badJobs, Double.MAX_VALUE);
|
||||
double costs = solutionCostsCalculator.getCosts(solution);
|
||||
solution.setCost(costs);
|
||||
logger.info("creation done");
|
||||
return solution;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,11 @@ public class SearchStrategy {
|
|||
}
|
||||
|
||||
public String getStrategyId() { return strategyId; }
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[strategyId="+strategyId+"][solution="+solution+"][accepted="+accepted+"]";
|
||||
}
|
||||
}
|
||||
|
||||
private static Logger logger = LogManager.getLogger(SearchStrategy.class);
|
||||
|
|
@ -84,7 +88,7 @@ public class SearchStrategy {
|
|||
this.solutionAcceptor = solutionAcceptor;
|
||||
this.solutionCostCalculator = solutionCostCalculator;
|
||||
this.id = id;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
|
@ -155,7 +159,7 @@ public class SearchStrategy {
|
|||
public void addModule(SearchStrategyModule module){
|
||||
if(module == null) throw new IllegalStateException("module to be added is null.");
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -19,11 +19,15 @@ package jsprit.core.algorithm;
|
|||
import jsprit.core.algorithm.listener.SearchStrategyListener;
|
||||
import jsprit.core.algorithm.listener.SearchStrategyModuleListener;
|
||||
import jsprit.core.util.RandomNumberGeneration;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class SearchStrategyManager {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
private List<SearchStrategyListener> searchStrategyListeners = new ArrayList<SearchStrategyListener>();
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ");
|
||||
|
||||
|
|
@ -188,8 +188,7 @@ public class VehicleRoutingAlgorithm {
|
|||
* @see {@link SearchStrategyManager}, {@link VehicleRoutingAlgorithmListener}, {@link AlgorithmStartsListener}, {@link AlgorithmEndsListener}, {@link IterationStartsListener}, {@link IterationEndsListener}
|
||||
*/
|
||||
public Collection<VehicleRoutingProblemSolution> searchSolutions(){
|
||||
logger.info("------------------------------------------------");
|
||||
logger.info("algorithm starts");
|
||||
logger.info("algorithm starts: " + "[maxIterations=" + maxIterations + "]");
|
||||
double now = System.currentTimeMillis();
|
||||
int noIterationsThisAlgoIsRunning = maxIterations;
|
||||
counter.reset();
|
||||
|
|
@ -199,9 +198,11 @@ public class VehicleRoutingAlgorithm {
|
|||
logger.info("iterations start");
|
||||
for(int i=0;i< maxIterations;i++){
|
||||
iterationStarts(i+1,problem,solutions);
|
||||
logger.debug("start iteration: " + i);
|
||||
counter.incCounter();
|
||||
SearchStrategy strategy = searchStrategyManager.getRandomStrategy();
|
||||
DiscoveredSolution discoveredSolution = strategy.run(problem, solutions);
|
||||
logger.trace("discovered solution: " + discoveredSolution);
|
||||
memorizeIfBestEver(discoveredSolution);
|
||||
selectedStrategy(discoveredSolution,problem,solutions);
|
||||
if(terminationManager.isPrematureBreak(discoveredSolution)){
|
||||
|
|
@ -214,9 +215,7 @@ public class VehicleRoutingAlgorithm {
|
|||
logger.info("iterations end at " + noIterationsThisAlgoIsRunning + " iterations");
|
||||
addBestEver(solutions);
|
||||
algorithmEnds(problem, solutions);
|
||||
logger.info("total time: " + ((System.currentTimeMillis()-now)/1000.0) + "s");
|
||||
logger.info("done");
|
||||
logger.info("------------------------------------------------");
|
||||
logger.info("took " + ((System.currentTimeMillis()-now)/1000.0) + " seconds");
|
||||
return solutions;
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +267,7 @@ public class VehicleRoutingAlgorithm {
|
|||
*/
|
||||
public void setMaxIterations(int maxIterations) {
|
||||
this.maxIterations = maxIterations;
|
||||
logger.info("set maxIterations to " + this.maxIterations);
|
||||
logger.debug("set maxIterations to " + this.maxIterations);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class SchrimpfAcceptance implements SolutionAcceptor, IterationStartsList
|
|||
public SchrimpfAcceptance(int solutionMemory, double alpha){
|
||||
this.alpha = alpha;
|
||||
this.solutionMemory = solutionMemory;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -49,9 +49,7 @@ public class SchrimpfInitialThresholdGenerator implements AlgorithmStartsListene
|
|||
|
||||
@Override
|
||||
public void informAlgorithmStarts(VehicleRoutingProblem problem,VehicleRoutingAlgorithm algorithm,Collection<VehicleRoutingProblemSolution> solutions) {
|
||||
logger.info("---------------------------------------------------------------------");
|
||||
logger.info("prepare schrimpfAcceptanceFunction, i.e. determine initial threshold");
|
||||
logger.info("start random-walk (see randomWalk.xml)");
|
||||
double now = System.currentTimeMillis();
|
||||
|
||||
/*
|
||||
|
|
@ -81,10 +79,9 @@ public class SchrimpfInitialThresholdGenerator implements AlgorithmStartsListene
|
|||
double initialThreshold = standardDeviation / 2;
|
||||
|
||||
schrimpfAcceptance.setInitialThreshold(initialThreshold);
|
||||
|
||||
logger.info("warmup done");
|
||||
logger.info("total time: " + ((System.currentTimeMillis()-now)/1000.0) + "s");
|
||||
logger.info("initial threshold: " + initialThreshold);
|
||||
|
||||
logger.info("took " + ((System.currentTimeMillis()-now)/1000.0) + " seconds");
|
||||
logger.debug("initial threshold: " + initialThreshold);
|
||||
logger.info("---------------------------------------------------------------------");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class AlgorithmConfigXmlReader {
|
|||
}
|
||||
|
||||
public void read(URL url){
|
||||
log.info("read algorithm-config from file " + url);
|
||||
log.debug("read algorithm: " + url);
|
||||
algorithmConfig.getXMLConfiguration().setURL(url);
|
||||
algorithmConfig.getXMLConfiguration().setAttributeSplittingDisabled(true);
|
||||
algorithmConfig.getXMLConfiguration().setDelimiterParsingDisabled(true);
|
||||
|
|
@ -70,7 +70,6 @@ public class AlgorithmConfigXmlReader {
|
|||
};
|
||||
algorithmConfig.getXMLConfiguration().setEntityResolver(resolver);
|
||||
algorithmConfig.getXMLConfiguration().setSchemaValidation(true);
|
||||
log.info("validating " + url + " with xsd-schema");
|
||||
}
|
||||
else{
|
||||
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){
|
||||
log.info("read algorithm-config from file " + filename);
|
||||
log.debug("read algorithm-config from file " + filename);
|
||||
URL url = Resource.getAsURL(filename);
|
||||
read(url);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -503,13 +503,13 @@ public class VehicleRoutingAlgorithms {
|
|||
//threading
|
||||
final ExecutorService executorService;
|
||||
if(nuOfThreads > 0){
|
||||
log.info("setup executor-service with " + nuOfThreads + " threads");
|
||||
log.debug("setup executor-service with " + nuOfThreads + " threads");
|
||||
executorService = Executors.newFixedThreadPool(nuOfThreads);
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, new AlgorithmEndsListener() {
|
||||
|
||||
@Override
|
||||
public void informAlgorithmEnds(VehicleRoutingProblem problem,Collection<VehicleRoutingProblemSolution> solutions) {
|
||||
log.info("shutdown executor-service");
|
||||
log.debug("shutdown executor-service");
|
||||
executorService.shutdown();
|
||||
}
|
||||
}));
|
||||
|
|
@ -645,18 +645,18 @@ public class VehicleRoutingAlgorithms {
|
|||
private static PrematureAlgorithmTermination getTerminationCriterion(HierarchicalConfiguration config, Set<PrioritizedVRAListener> algorithmListeners) {
|
||||
String basedOn = config.getString("[@basedOn]");
|
||||
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;
|
||||
}
|
||||
if(basedOn.equals("iterations")){
|
||||
log.info("set prematureBreak based on iterations");
|
||||
log.debug("set prematureBreak based on iterations");
|
||||
String iter = config.getString("iterations");
|
||||
if(iter == null) throw new IllegalStateException("iterations is missing");
|
||||
int iterations = Integer.valueOf(iter);
|
||||
return new IterationWithoutImprovementTermination(iterations);
|
||||
}
|
||||
if(basedOn.equals("time")){
|
||||
log.info("set prematureBreak based on time");
|
||||
log.debug("set prematureBreak based on time");
|
||||
String timeString = config.getString("time");
|
||||
if(timeString == null) throw new IllegalStateException("time is missing");
|
||||
long time = Long.parseLong(timeString);
|
||||
|
|
@ -665,7 +665,7 @@ public class VehicleRoutingAlgorithms {
|
|||
return timeBreaker;
|
||||
}
|
||||
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 iterationsString = config.getString("iterations");
|
||||
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) {
|
||||
String basedOn = config.getString("prematureBreak[@basedOn]");
|
||||
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;
|
||||
}
|
||||
if(basedOn.equals("iterations")){
|
||||
log.info("set prematureBreak based on iterations");
|
||||
log.debug("set prematureBreak based on iterations");
|
||||
String iter = config.getString("prematureBreak.iterations");
|
||||
if(iter == null) throw new IllegalStateException("prematureBreak.iterations is missing");
|
||||
int iterations = Integer.valueOf(iter);
|
||||
return new IterationWithoutImprovementTermination(iterations);
|
||||
}
|
||||
if(basedOn.equals("time")){
|
||||
log.info("set prematureBreak based on time");
|
||||
log.debug("set prematureBreak based on time");
|
||||
String timeString = config.getString("prematureBreak.time");
|
||||
if(timeString == null) throw new IllegalStateException("prematureBreak.time is missing");
|
||||
long time = Long.parseLong(timeString);
|
||||
|
|
@ -702,7 +702,7 @@ public class VehicleRoutingAlgorithms {
|
|||
return timeBreaker;
|
||||
}
|
||||
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 iterationsString = config.getString("prematureBreak.iterations");
|
||||
if(thresholdString == null) throw new IllegalStateException("prematureBreak.threshold is missing");
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public final class BestInsertion extends AbstractInsertionStrategy{
|
|||
public BestInsertion(JobInsertionCostsCalculator jobInsertionCalculator, VehicleRoutingProblem vehicleRoutingProblem) {
|
||||
super(vehicleRoutingProblem);
|
||||
bestInsertionCostCalculator = jobInsertionCalculator;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public final class BestInsertionConcurrent extends AbstractInsertionStrategy{
|
|||
this.nuOfBatches = nuOfBatches;
|
||||
bestInsertionCostCalculator = jobInsertionCalculator;
|
||||
completionService = new ExecutorCompletionService<Insertion>(executorService);
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class CalculatesServiceInsertionWithTimeScheduling implements JobInsertionCostsC
|
|||
CalculatesServiceInsertionWithTimeScheduling(JobInsertionCostsCalculator jic, double t, double f) {
|
||||
super();
|
||||
this.jic = jic;
|
||||
log.info("initialise " + this);
|
||||
log.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class CalculatesServiceInsertionWithTimeSchedulingInSlices implements JobInserti
|
|||
this.jic = jic;
|
||||
this.timeSlice = timeSlice;
|
||||
this.nOfDepartureTimes = neighbors;
|
||||
log.info("initialise " + this);
|
||||
log.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ final class JobInsertionConsideringFixCostsCalculator implements JobInsertionCos
|
|||
super();
|
||||
this.standardServiceInsertion = standardInsertionCalculator;
|
||||
this.stateGetter = stateGetter;
|
||||
logger.info("inialise " + this);
|
||||
logger.debug("inialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -76,7 +76,7 @@ final class JobInsertionConsideringFixCostsCalculator implements JobInsertionCos
|
|||
|
||||
public void setWeightOfFixCost(double weight){
|
||||
weight_deltaFixCost = weight;
|
||||
logger.info("set weightOfFixCostSaving to " + weight);
|
||||
logger.debug("set weightOfFixCostSaving to " + weight);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public class RegretInsertion extends AbstractInsertionStrategy {
|
|||
this.scoringFunction = new DefaultScorer(vehicleRoutingProblem);
|
||||
this.insertionCostsCalculator = jobInsertionCalculator;
|
||||
this.vrp = vehicleRoutingProblem;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class RegretInsertionConcurrent extends AbstractInsertionStrategy {
|
|||
this.insertionCostsCalculator = jobInsertionCalculator;
|
||||
this.vrp = vehicleRoutingProblem;
|
||||
completionService = new ExecutorCompletionService<ScoredJob>(executorService);
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ final class ServiceInsertionCalculator implements JobInsertionCostsCalculator{
|
|||
softRouteConstraint = constraintManager;
|
||||
this.additionalTransportCostsCalculator = additionalTransportCostsCalculator;
|
||||
additionalAccessEgressCalculator = new AdditionalAccessEgressCalculator(routingCosts);
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
public void setJobActivityFactory(JobActivityFactory jobActivityFactory){
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ final class ServiceInsertionOnRouteLevelCalculator implements JobInsertionCostsC
|
|||
|
||||
public void setMemorySize(int 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) {
|
||||
|
|
@ -92,7 +92,7 @@ final class ServiceInsertionOnRouteLevelCalculator implements JobInsertionCostsC
|
|||
this.hardRouteLevelConstraint = hardRouteLevelConstraint;
|
||||
this.hardActivityLevelConstraint = hardActivityLevelConstraint;
|
||||
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) {
|
||||
this.nuOfActsForwardLooking = nOfActsForwardLooking;
|
||||
logger.info("set [forwardLooking="+nOfActsForwardLooking+"]");
|
||||
logger.debug("set [forwardLooking="+nOfActsForwardLooking+"]");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ final class ShipmentInsertionCalculator implements JobInsertionCostsCalculator{
|
|||
this.softRouteConstraint = constraintManager;
|
||||
this.transportCosts = routingCosts;
|
||||
additionalAccessEgressCalculator = new AdditionalAccessEgressCalculator(routingCosts);
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
public void setJobActivityFactory(JobActivityFactory activityFactory){
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ final class VehicleTypeDependentJobInsertionCalculator implements JobInsertionCo
|
|||
this.insertionCalculator = jobInsertionCalc;
|
||||
this.vrp = vrp;
|
||||
getInitialVehicleIds();
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
private void getInitialVehicleIds() {
|
||||
|
|
@ -89,7 +89,7 @@ final class VehicleTypeDependentJobInsertionCalculator implements JobInsertionCo
|
|||
* @param vehicleSwitchAllowed the vehicleSwitchAllowed to set
|
||||
*/
|
||||
public void setVehicleSwitchAllowed(boolean vehicleSwitchAllowed) {
|
||||
logger.info("set vehicleSwitchAllowed to " + vehicleSwitchAllowed);
|
||||
logger.debug("set vehicleSwitchAllowed to " + vehicleSwitchAllowed);
|
||||
this.vehicleSwitchAllowed = vehicleSwitchAllowed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
|
|||
super();
|
||||
this.vrp = vrp;
|
||||
this.jobDistance = jobDistance;
|
||||
logger.info("intialise " + this);
|
||||
logger.debug("intialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -54,12 +54,12 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
|
|||
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
|
||||
private void calculateDistancesFromJob2Job() {
|
||||
logger.info("preprocess distances between locations ...");
|
||||
logger.debug("preprocess distances between locations ...");
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
int nuOfDistancesStored = 0;
|
||||
|
|
@ -86,7 +86,7 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
|
|||
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
|
|||
this.vrp = vrp;
|
||||
this.jobDistance = jobDistance;
|
||||
this.capacity = capacity;
|
||||
logger.info("intialise " + this);
|
||||
logger.debug("intialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -59,13 +59,13 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
|
|||
|
||||
@Override
|
||||
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;
|
||||
calculateDistancesFromJob2Job();
|
||||
}
|
||||
|
||||
private void calculateDistancesFromJob2Job() {
|
||||
logger.info("preprocess distances between locations ...");
|
||||
logger.debug("preprocess distances between locations ...");
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
int nuOfDistancesStored = 0;
|
||||
|
|
@ -101,7 +101,7 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
|
|||
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ public final class RuinClusters extends AbstractRuinStrategy implements Iteratio
|
|||
}
|
||||
});
|
||||
this.jobNeighborhoods = jobNeighborhoods;
|
||||
logger.info("initialise " + this);
|
||||
logger.info("done");
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
public void setNoClusters(int noClusters) {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public final class RuinRadial extends AbstractRuinStrategy {
|
|||
JobNeighborhoodsImplWithCapRestriction jobNeighborhoodsImpl = new JobNeighborhoodsImplWithCapRestriction(vrp, jobDistance, noJobsToMemorize);
|
||||
jobNeighborhoodsImpl.initialise();
|
||||
jobNeighborhoods = jobNeighborhoodsImpl;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
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);
|
||||
jobNeighborhoodsImpl.initialise();
|
||||
jobNeighborhoods = jobNeighborhoodsImpl;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
public RuinRadial(VehicleRoutingProblem vrp, int noJobs2beRemoved, JobNeighborhoods neighborhoods) {
|
||||
|
|
@ -103,7 +103,7 @@ public final class RuinRadial extends AbstractRuinStrategy {
|
|||
|
||||
};
|
||||
jobNeighborhoods = neighborhoods;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public final class RuinRadialMultipleCenters extends AbstractRuinStrategy {
|
|||
JobNeighborhoodsImplWithCapRestriction jobNeighborhoodsImpl = new JobNeighborhoodsImplWithCapRestriction(vrp, jobDistance, noJobsToMemorize);
|
||||
jobNeighborhoodsImpl.initialise();
|
||||
jobNeighborhoods = jobNeighborhoodsImpl;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
public void setNumberOfRuinCenters(int noCenters){
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ public final class RuinRandom extends AbstractRuinStrategy {
|
|||
return selectNuOfJobs2BeRemoved();
|
||||
}
|
||||
});
|
||||
logger.info("initialise " + this);
|
||||
logger.info("done");
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -64,8 +64,7 @@ public final class RuinWorst extends AbstractRuinStrategy {
|
|||
return initialNumberJobsToRemove;
|
||||
}
|
||||
});
|
||||
logger.info("initialise " + this);
|
||||
logger.info("done");
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class IterationWithoutImprovementTermination implements PrematureAlgorith
|
|||
*/
|
||||
public IterationWithoutImprovementTermination(int noIterationsWithoutImprovement){
|
||||
this.noIterationWithoutImprovement =noIterationsWithoutImprovement;
|
||||
log.info("initialise " + this);
|
||||
log.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class TimeTermination implements PrematureAlgorithmTermination, Algorithm
|
|||
public TimeTermination(long timeThreshold_in_milliseconds) {
|
||||
super();
|
||||
this.timeThreshold = timeThreshold_in_milliseconds;
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
public void setTimeGetter(TimeGetter timeGetter) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class VariationCoefficientTermination implements PrematureAlgorithmTermin
|
|||
this.noIterations = noIterations;
|
||||
this.variationCoefficientThreshold = variationCoefficientThreshold;
|
||||
solutionValues = new double[noIterations];
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -399,9 +399,7 @@ public class VehicleRoutingProblem {
|
|||
* @return {@link VehicleRoutingProblem}
|
||||
*/
|
||||
public VehicleRoutingProblem build() {
|
||||
logger.info("build problem ...");
|
||||
if(transportCosts == null){
|
||||
logger.warn("set routing costs crowFlyDistance.");
|
||||
transportCosts = new CrowFlyCosts(getLocations());
|
||||
}
|
||||
for(Job job : tentativeJobs.values())
|
||||
|
|
@ -556,7 +554,7 @@ public class VehicleRoutingProblem {
|
|||
this.locations = builder.getLocations();
|
||||
this.activityMap = builder.activityMap;
|
||||
this.nuActivities = builder.activityIndexCounter;
|
||||
logger.info("initialise " + this);
|
||||
logger.info("setup problem: " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public class VrpXMLReader{
|
|||
}
|
||||
|
||||
public void read(String filename) {
|
||||
logger.info("read vrp from file " + filename);
|
||||
logger.debug("read vrp: " + filename);
|
||||
XMLConfiguration xmlConfig = new XMLConfiguration();
|
||||
xmlConfig.setFileName(filename);
|
||||
xmlConfig.setAttributeSplittingDisabled(true);
|
||||
|
|
@ -158,10 +158,9 @@ public class VrpXMLReader{
|
|||
};
|
||||
xmlConfig.setEntityResolver(resolver);
|
||||
xmlConfig.setSchemaValidation(true);
|
||||
logger.info("validating " + filename + " with xsd-schema");
|
||||
}
|
||||
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 {
|
||||
|
|
@ -617,7 +616,7 @@ public class VrpXMLReader{
|
|||
}
|
||||
if(coordX == null || coordY == null) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -644,7 +643,7 @@ public class VrpXMLReader{
|
|||
String endCoordY = vehicleConfig.getString("endLocation.coord[@y]");
|
||||
if(endCoordX == null || endCoordY == null) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class VrpXMLWriter {
|
|||
|
||||
public void write(String filename){
|
||||
if(!filename.endsWith(".xml")) filename+=".xml";
|
||||
log.info("write vrp to " + filename);
|
||||
log.info("write vrp: " + filename);
|
||||
XMLConf xmlConfig = new XMLConf();
|
||||
xmlConfig.setFileName(filename);
|
||||
xmlConfig.setRootElementName("problem");
|
||||
|
|
|
|||
|
|
@ -120,4 +120,8 @@ public class VehicleRoutingProblemSolution {
|
|||
return unassignedJobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[costs=" + cost + "][routes="+routes.size()+"][unassigned="+unassignedJobs.size()+"]";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class InfiniteVehicles implements VehicleFleetManager{
|
|||
|
||||
public InfiniteVehicles(Collection<Vehicle> vehicles){
|
||||
extractTypes(vehicles);
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
|||
this.vehicles = vehicles;
|
||||
this.lockedVehicles = new HashSet<Vehicle>();
|
||||
makeMap();
|
||||
logger.info("initialise " + this);
|
||||
logger.debug("initialise " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -41,16 +41,16 @@ public class Resource {
|
|||
if (url != null) {
|
||||
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);
|
||||
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;
|
||||
}
|
||||
try {
|
||||
return file.toURI().toURL();
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -60,16 +60,16 @@ public class Resource {
|
|||
if (stream != null) {
|
||||
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);
|
||||
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;
|
||||
}
|
||||
try {
|
||||
return new FileInputStream(file);
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="trace">
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue