fix limit on refill in findPaths
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user