Skip to content

faq 72744964

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

How to run outside optimizing route algorithm every 5 minutes in the simulation while keeping the simulation timestep resolution the same?

by Yousef Hindy on 2016-07-07 00:40:46


I asked this in the issues area I think that may have been the wrong area:

I need to interface the MATLAB optimizer that I have that takes in some trip data and creates the optimal customer and rebalancing paths for autonomous vehicles.

I am using the dvrp module to dynamically route the passengers, but for the LeastPathCostCalculator I need to have a data structure mapping nodes to routes. When a customer shows up and wants to go on a route that hasn't been computed, one is made on the fly.

How do I get into the QSim and make it so that every 5 minutes the MATLAB optimizer is called and returns the routes I need?

Thanks!


Comments: 1


Re: How to run outside optimizing route algorithm every 5 minutes in the simulation while keeping the simulation timestep resolution the same?

by Michal Maciejewski on 2016-07-07 08:17:10

Hi Yousef,

Please have a look at the AbstractTaxiOptimizer. It implements MobsimBeforeSimStepListener, so before each time step the method notifyMobsimBeforeSimStep(MobsimBeforeSimStepEvent e) is called. This is where we decide if we want to re-optimise. One of the checks is 

e.getSimulationTime() % epochLength == 0

In your case, epochLength would be 300. One more thing, before QSim starts, the taxi optimiser is registered as a QSim listener.

Hope that helps.

Michal

Clone this wiki locally