Add setting to increase cost/distance of aircraft linkgraph links
This commit is contained in:
@@ -284,6 +284,8 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
|
||||
|
||||
this->job.path_allocator.SetParameters(sizeof(Tannotation), (8192 - 32) / sizeof(Tannotation));
|
||||
|
||||
const uint16 aircraft_link_scale = this->job.Settings().aircraft_link_scale;
|
||||
|
||||
for (NodeID node = 0; node < size; ++node) {
|
||||
Tannotation *anno = new (this->job.path_allocator.Allocate()) Tannotation(node, node == source_node);
|
||||
anno->UpdateAnnotation();
|
||||
@@ -310,6 +312,10 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
|
||||
}
|
||||
/* punish in-between stops a little */
|
||||
uint distance = DistanceMaxPlusManhattan(this->job[from].XY(), this->job[to].XY()) + 1;
|
||||
if (edge.LastAircraftUpdate() != INVALID_DATE && aircraft_link_scale != 100) {
|
||||
distance *= aircraft_link_scale;
|
||||
distance /= 100;
|
||||
}
|
||||
Tannotation *dest = static_cast<Tannotation *>(paths[to]);
|
||||
if (dest->IsBetter(source, capacity, capacity - edge.Flow(), distance)) {
|
||||
if (dest->GetAnnosSetFlag()) annos.erase(AnnoSetItem<Tannotation>(dest));
|
||||
|
Reference in New Issue
Block a user