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

add overrides

This commit is contained in:
oblonski 2015-03-06 16:47:04 +01:00
parent 1a63178e05
commit 7234e12ec7
2 changed files with 4 additions and 3 deletions

View file

@ -29,6 +29,7 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
logger.info("intialise " + this); logger.info("intialise " + this);
} }
@Override
public Iterator<Job> getNearestNeighborsIterator(int nNeighbors, Job neighborTo){ public Iterator<Job> getNearestNeighborsIterator(int nNeighbors, Job neighborTo){
TreeSet<ReferencedJob> tree = distanceNodeTree.get(neighborTo.getId()); TreeSet<ReferencedJob> tree = distanceNodeTree.get(neighborTo.getId());
if(tree == null) return new Iterator<Job>() { if(tree == null) return new Iterator<Job>() {
@ -46,6 +47,7 @@ class JobNeighborhoodsImpl implements JobNeighborhoods {
return new NearestNeighborhoodIterator(descendingIterator, nNeighbors); return new NearestNeighborhoodIterator(descendingIterator, nNeighbors);
} }
@Override
public void initialise(){ public void initialise(){
logger.info("calculates and memorizes distances from EACH job to EACH job --> n^2 calculations"); logger.info("calculates and memorizes distances from EACH job to EACH job --> n^2 calculations");
calculateDistancesFromJob2Job(); calculateDistancesFromJob2Job();

View file

@ -32,9 +32,7 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
logger.info("intialise " + this); logger.info("intialise " + this);
} }
/* @Override
TODO: obviously nearestNeighbor does not work with a single customer
*/
public Iterator<Job> getNearestNeighborsIterator(int nNeighbors, Job neighborTo){ public Iterator<Job> getNearestNeighborsIterator(int nNeighbors, Job neighborTo){
TreeSet<ReferencedJob> tree = distanceNodeTree.get(neighborTo.getId()); TreeSet<ReferencedJob> tree = distanceNodeTree.get(neighborTo.getId());
if(tree == null) return new Iterator<Job>() { if(tree == null) return new Iterator<Job>() {
@ -54,6 +52,7 @@ class JobNeighborhoodsImplWithCapRestriction implements JobNeighborhoods {
return new NearestNeighborhoodIterator(descendingIterator, nNeighbors); return new NearestNeighborhoodIterator(descendingIterator, nNeighbors);
} }
@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.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.");
if(capacity==0) return; if(capacity==0) return;