Skip to content

Commit a70b1c3

Browse files
authored
Merge pull request #74 from Janekdererste/small_enhancements
Small enhancements
2 parents 59e7727 + ae83842 commit a70b1c3

File tree

10 files changed

+24
-20
lines changed

10 files changed

+24
-20
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ flexi_logger = { version = "0.22", features = ["async"] }
1616
log = "0.4"
1717
clap = { version = "4.0.29", features = ["derive"] }
1818
fast_paths = "0.2.0"
19-
rust_road_router = { git = "https://github.com/kit-algo/rust_road_router" }
19+
rust_road_router = { git = "https://github.com/paulheinr/rust_road_router", branch = "clean_log" }
2020
mpi = "0.6"
2121
geo = "0.23.1"
2222
# dependencies for serialization with protobuf

src/simulation/controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::simulation::messaging::events::EventsPublisher;
88
use crate::simulation::messaging::message_broker::MpiMessageBroker;
99
use crate::simulation::messaging::messages::proto::Vehicle;
1010
use crate::simulation::messaging::travel_time_collector::TravelTimeCollector;
11-
use crate::simulation::network::partitioned_network::Network;
11+
use crate::simulation::network::network::Network;
1212
use crate::simulation::partition_info::PartitionInfo;
1313
use crate::simulation::population::Population;
1414
use crate::simulation::routing::router::Router;

src/simulation/io/network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::simulation::id_mapping::MatsimIdMapping;
22
use crate::simulation::io::matsim_id::MatsimId;
33
use crate::simulation::io::xml_reader;
4+
use crate::simulation::network::network::Network;
45
use crate::simulation::network::node::NodeVehicle;
5-
use crate::simulation::network::partitioned_network::Network;
66
use flate2::Compression;
77
use log::info;
88
use quick_xml::se::to_writer;

src/simulation/network/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ mod flow_cap;
22
pub mod link;
33
pub mod network_partition;
44
pub mod node;
5-
pub mod partitioned_network;
5+
pub mod network;
66
pub mod routing_kit_network;
77
mod vehicles;
File renamed without changes.

src/simulation/network/routing_kit_network.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pub struct RoutingKitNetwork {
99
pub(crate) head: Vec<NodeId>,
1010
pub(crate) travel_time: Vec<Weight>,
1111
pub(crate) link_ids: Vec<u64>,
12-
pub(crate) latitude: Vec<f32>,
13-
pub(crate) longitude: Vec<f32>,
12+
pub(crate) x: Vec<f32>,
13+
pub(crate) y: Vec<f32>,
1414
}
1515

1616
impl RoutingKitNetwork {
@@ -20,8 +20,8 @@ impl RoutingKitNetwork {
2020
head: Vec::new(),
2121
travel_time: Vec::new(),
2222
link_ids: Vec::new(),
23-
latitude: Vec::new(),
24-
longitude: Vec::new(),
23+
x: Vec::new(),
24+
y: Vec::new(),
2525
}
2626
}
2727

src/simulation/population.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::simulation::config::RoutingMode;
22
use crate::simulation::id_mapping::{MatsimIdMapping, MatsimIdMappings};
33
use crate::simulation::io::population::{IOPerson, IOPlanElement, IOPopulation};
44
use crate::simulation::messaging::messages::proto::Agent;
5+
use crate::simulation::network::network::Network;
56
use crate::simulation::network::node::NodeVehicle;
6-
use crate::simulation::network::partitioned_network::Network;
77
use std::collections::btree_map::BTreeMap;
88

99
#[derive(Debug)]

src/simulation/routing/inertial_flow_cutter_adapter.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::fmt::Display;
44
use std::fs::{create_dir_all, remove_dir_all, remove_file, File};
55
use std::io::{BufRead, BufReader, Write};
66
use std::path::PathBuf;
7-
use std::process::Command;
7+
use std::process::{Command, Stdio};
88

99
pub struct InertialFlowCutterAdapter {
1010
pub inertial_flow_cutter_path: PathBuf,
@@ -95,6 +95,7 @@ impl InertialFlowCutterAdapter {
9595
.to_owned()
9696
+ "_bin",
9797
)
98+
.stdout(Stdio::null())
9899
.status()
99100
.expect("Failed to compute ordering");
100101
}
@@ -157,12 +158,15 @@ impl InertialFlowCutterAdapter {
157158
&routing_kit_network.travel_time,
158159
self.temp_output_path().join("travel_time"),
159160
);
161+
162+
// the InertialFlowCutter script expects these file names but interprets them as Euclidean coordinates
163+
// (https://github.com/Janekdererste/rust_q_sim/issues/10)
160164
InertialFlowCutterAdapter::serialize_vector(
161-
&routing_kit_network.latitude,
165+
&routing_kit_network.x,
162166
self.temp_output_path().join("latitude"),
163167
);
164168
InertialFlowCutterAdapter::serialize_vector(
165-
&routing_kit_network.longitude,
169+
&routing_kit_network.y,
166170
self.temp_output_path().join("longitude"),
167171
);
168172
}

src/simulation/routing/network_converter.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ impl NetworkConverter {
5656
let mut head = Vec::new();
5757
let mut travel_time = Vec::new();
5858
let mut link_ids = Vec::new();
59-
let mut latitude = Vec::new();
60-
let mut longitude = Vec::new();
59+
let mut x = Vec::new();
60+
let mut y = Vec::new();
6161

6262
Self::check_network_valid(&matsim_network);
6363

@@ -74,8 +74,8 @@ impl NetworkConverter {
7474

7575
for node in matsim_network.nodes() {
7676
//TODO: make sure, that the coordinate system is correct
77-
longitude.push(node.x);
78-
latitude.push(node.y);
77+
y.push(node.x);
78+
x.push(node.y);
7979

8080
first_out.push((links_before) as EdgeId);
8181

@@ -117,8 +117,8 @@ impl NetworkConverter {
117117
head,
118118
travel_time,
119119
link_ids,
120-
latitude,
121-
longitude,
120+
x,
121+
y,
122122
}
123123
}
124124

@@ -158,7 +158,7 @@ mod test {
158158
assert_eq!(network.head, vec![2, 3, 2, 3, 1, 2]);
159159
assert_eq!(network.travel_time, vec![1, 2, 1, 4, 2, 5]);
160160
assert_eq!(network.link_ids, Vec::<u64>::new());
161-
// we don't check latitude and longitude so far
161+
// we don't check y and y so far
162162
}
163163

164164
#[test]

0 commit comments

Comments
 (0)