Linkgraph: Changes to job scheduling algorithm.
This is to improve responsiveness of link graph updates, whilst avoiding being blocked waiting for updates to complete. Previously, large numbers of cheap jobs resulted in poor responsiveness as it took a long time for jobs to cycle round. Add 'linkgraph' debug category.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "../core/pool_type.hpp"
|
||||
#include "../core/smallmap_type.hpp"
|
||||
#include "../core/smallmatrix_type.hpp"
|
||||
#include "../core/bitmath_func.hpp"
|
||||
#include "../station_base.h"
|
||||
#include "../cargotype.h"
|
||||
#include "../date_func.h"
|
||||
@@ -523,6 +524,11 @@ public:
|
||||
NodeID AddNode(const Station *st);
|
||||
void RemoveNode(NodeID id);
|
||||
|
||||
inline uint CalculateCostEstimate() const {
|
||||
uint64_t size_squared = this->Size() * this->Size();
|
||||
return size_squared * FindLastBit(size_squared * size_squared); // N^2 * 4log_2(N)
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class LinkGraph::ConstNode;
|
||||
friend class LinkGraph::Node;
|
||||
|
Reference in New Issue
Block a user