mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-25 03:41:09 +03:00
smarter estimate about cars queued on last step... but disabled it :(
This commit is contained in:
parent
ce340f5668
commit
4ae478a7a5
@ -69,7 +69,6 @@ fn main() {
|
||||
None,
|
||||
);
|
||||
timer.done();
|
||||
println!("Sim done at {}", sim.time());
|
||||
println!("{:?}", sim.get_score());
|
||||
if flags.enable_profiler && save_at.is_none() {
|
||||
cpuprofiler::PROFILER.lock().unwrap().stop().unwrap();
|
||||
|
@ -259,6 +259,7 @@ impl DrivingSimState {
|
||||
// Note that 'car' is currently missing from self.cars, but they can't be on
|
||||
// 'goto' right now -- they're on 'from'.
|
||||
if !self.queues[&goto].room_at_end(time, &self.cars) {
|
||||
// TODO Subscribe to the target queue, wake up when somebody leaves it.
|
||||
scheduler.push(time + BLIND_RETRY, Command::UpdateCar(car.vehicle.id));
|
||||
return false;
|
||||
}
|
||||
@ -415,7 +416,22 @@ impl DrivingSimState {
|
||||
return true;
|
||||
}
|
||||
None => {
|
||||
scheduler.push(time + BLIND_RETRY, Command::UpdateCar(car.vehicle.id));
|
||||
// If this car wasn't blocked at all, when would it reach its goal?
|
||||
let ideal_end_time = match car.crossing_state(our_dist, time, map) {
|
||||
CarState::Crossing(time_int, _) => time_int.end,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
// TODO For now, always use BLIND_RETRY. Measured things to be slower
|
||||
// otherwise. :(
|
||||
if ideal_end_time == time || true {
|
||||
// Haha, no such luck. We're super super close to the goal, but not
|
||||
// quite there yet.
|
||||
scheduler.push(time + BLIND_RETRY, Command::UpdateCar(car.vehicle.id));
|
||||
} else {
|
||||
scheduler.push(ideal_end_time, Command::UpdateCar(car.vehicle.id));
|
||||
}
|
||||
// TODO For cars stuck on their last step, this will spam a fair bit. But
|
||||
// that should be pretty rare.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -390,6 +390,7 @@ impl Sim {
|
||||
panic!("Time limit {} hit", self.time);
|
||||
}
|
||||
if self.is_done() {
|
||||
println!("{}, {}", self.summary(), self.measure_speed(&mut benchmark));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user