osrm-backend/include/partition/inertial_flow.hpp
Daniel J. Hofmann dd60ae31ae Implement Parallel Spatial-Ordering/Cut Selection
Extends explanation for recursive bisection ids
Cleans up Bisection State
Removes license boilerplate from partitioner config
Sorts Spatially and picks Sources and Sinks
Uses sets for sources and sinks for now; see how large they will get
Runs n cuts in parallel changing the slope and uses the best
Clarifies balance <-> ratio naming
2017-03-01 16:09:29 +00:00

45 lines
1.1 KiB
C++

#ifndef OSRM_PARTITION_INERTIAL_FLOW_HPP_
#define OSRM_PARTITION_INERTIAL_FLOW_HPP_
#include "partition/graph_view.hpp"
#include <unordered_set>
#include <vector>
namespace osrm
{
namespace partition
{
class InertialFlow
{
public:
InertialFlow(const GraphView &view);
std::vector<bool> ComputePartition(const double balance, const double source_sink_rate);
private:
// Spatially ordered sources and sink ids.
// The node ids refer to nodes in the GraphView.
struct SpatialOrder
{
std::unordered_set<NodeID> sources;
std::unordered_set<NodeID> sinks;
};
// Creates a spatial order of n * sources "first" and n * sink "last" node ids.
// The slope determines the spatial order for sorting node coordinates.
SpatialOrder MakeSpatialOrder(double ratio, double slope) const;
// Makes n cuts with different spatial orders and returns the best.
MinCut bestMinCut(std::size_t n, double ratio) const;
// The subgraph to partition into two parts.
const GraphView &view;
};
} // namespace partition
} // namespace osrm
#endif // OSRM_PARTITION_INERTIAL_FLOW_HPP_