diff --git a/od2net/src/config.rs b/od2net/src/config.rs index 4019c9f..fc794e2 100644 --- a/od2net/src/config.rs +++ b/od2net/src/config.rs @@ -55,6 +55,9 @@ pub enum ODPattern { }, /// Just read GeoJSON LineStrings from this path LineStrings(String), + /// One trip from every intersection to every other intersection. This is likely a very + /// unrealistic pattern. + AllPairsIntersections, } #[derive(Clone, PartialEq, Serialize, Deserialize)] diff --git a/od2net/src/main.rs b/od2net/src/main.rs index c1a0a90..e9b7f0c 100644 --- a/od2net/src/main.rs +++ b/od2net/src/main.rs @@ -103,6 +103,7 @@ fn main() -> Result<()> { let requests = od2net::od::generate_requests( &config.requests, format!("{directory}/input"), + &network, args.rng_seed, &mut timer, )?; diff --git a/od2net/src/od.rs b/od2net/src/od.rs index f6382e2..907ddbf 100644 --- a/od2net/src/od.rs +++ b/od2net/src/od.rs @@ -11,12 +11,14 @@ use rstar::{RTree, AABB}; use serde::Deserialize; use super::config::{ODPattern, Requests}; +use super::network::Network; use super::requests::Request; use super::timer::Timer; pub fn generate_requests( config: &Requests, input_directory: String, + network: &Network, rng_seed: u64, timer: &mut Timer, ) -> Result> { @@ -177,6 +179,15 @@ pub fn generate_requests( requests = Request::load_from_geojson(format!("{input_directory}/{path}"))?; timer.stop(); } + ODPattern::AllPairsIntersections => { + for from in network.intersections.values() { + let (x1, y1) = from.to_degrees(); + for to in network.intersections.values() { + let (x2, y2) = to.to_degrees(); + requests.push(Request { x1, y1, x2, y2 }); + } + } + } } Ok(requests)