Archived
0

fix limit on refill in findPaths

This commit is contained in:
iMoHax
2014-08-30 13:20:04 +04:00
parent 242bb7044c
commit de37399992
5 changed files with 55 additions and 3 deletions

View File

@@ -132,7 +132,7 @@ public class Graph<T extends Connectable<T>> {
Path<T> path = head.connectTo(next.getTarget(), limit < next.getLength());
double nextLimit = withRefill ? limit - next.getLength(): stock;
// refill
if (nextLimit < 0 ) nextLimit = maxDistance - next.getLength();
if (nextLimit < 0 ) nextLimit = stock - next.getLength();
if (findPaths(paths, max, path, target, deep - 1, nextLimit)) return true;
}
}

View File

@@ -317,7 +317,7 @@ public class PathRoute extends Path<Vendor> {
if (o == null){
o = p.getBest();
if (o!= null){
LOG.trace("{} is lands for by by order {}", p, o);
LOG.trace("{} is lands for buy by order {}", p, o);
res++;
}
} else {
@@ -343,4 +343,13 @@ public class PathRoute extends Path<Vendor> {
return p;
}
public static PathRoute toPathRoute(Vendor... items){
Vendor t = items[0];
PathRoute path = new PathRoute(new Vertex<>(t));
for (int i = 1; i < items.length; i++) {
t = items[i];
path = new PathRoute(path, new Vertex<>(t), false);
}
return path;
}
}