Package jsprit.core.util

Examples of jsprit.core.util.StopWatch


      calculateDistancesFromJob2Job();
    }
   
    private void calculateDistancesFromJob2Job() {
      logger.info("preprocess distances between locations ...");
      StopWatch stopWatch = new StopWatch();
      stopWatch.start();
      int nuOfDistancesStored = 0;
      for (Job i : vrp.getJobs().values()) {
        TreeSet<ReferencedJob> treeSet = new TreeSet<ReferencedJob>(
            new Comparator<ReferencedJob>() {
              @Override
              public int compare(ReferencedJob o1, ReferencedJob o2) {
                if (o1.getDistance() <= o2.getDistance()) {
                  return -1;
                } else {
                  return 1;
                }
              }
            });
        distanceNodeTree.put(i.getId(), treeSet);
        for (Job j : vrp.getJobs().values()) {
          if(i==j) continue;
          double distance = jobDistance.getDistance(i, j);
          ReferencedJob refNode = new ReferencedJob(j, distance);
          treeSet.add(refNode);
          nuOfDistancesStored++;
        }

      }
      stopWatch.stop();
      logger.info("preprocessing comp-time: " + stopWatch + "; nuOfDistances stored: " + nuOfDistancesStored + "; estimated memory: " +
          (distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) + " bytes");
    }
View Full Code Here


      calculateDistancesFromJob2Job();
    }
   
    private void calculateDistancesFromJob2Job() {
      logger.info("preprocess distances between locations ...");
      StopWatch stopWatch = new StopWatch();
      stopWatch.start();
      int nuOfDistancesStored = 0;
      for (Job i : vrp.getJobs().values()) {
        TreeSet<ReferencedJob> treeSet = new TreeSet<ReferencedJob>(
            new Comparator<ReferencedJob>() {
              @Override
              public int compare(ReferencedJob o1, ReferencedJob o2) {
                if (o1.getDistance() <= o2.getDistance()) {
                  return -1;
                } else {
                  return 1;
                }
              }
            });
        distanceNodeTree.put(i.getId(), treeSet);
        for (Job j : vrp.getJobs().values()) {
          if(i==j) continue;
          double distance = jobDistance.getDistance(i, j);
          ReferencedJob refNode = new ReferencedJob(j, distance);
          if(treeSet.size() < capacity){
            treeSet.add(refNode);
            nuOfDistancesStored++;
          }
          else{
            if(treeSet.last().getDistance() > distance){
              treeSet.pollLast();
              treeSet.add(refNode);
            }
          }
        }
        assert treeSet.size() <= capacity : "treeSet.size() is bigger than specified capacity";

      }
      stopWatch.stop();
      logger.info("preprocessing comp-time: " + stopWatch + "; nuOfDistances stored: " + nuOfDistancesStored + "; estimated memory: " +
          (distanceNodeTree.keySet().size()*64+nuOfDistancesStored*92) + " bytes");
    }
View Full Code Here

TOP

Related Classes of jsprit.core.util.StopWatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.