01.01.2015 Views

LARGE-SCALE PARALLEL GRAPH-BASED SIMULATIONS - MATSim

LARGE-SCALE PARALLEL GRAPH-BASED SIMULATIONS - MATSim

LARGE-SCALE PARALLEL GRAPH-BASED SIMULATIONS - MATSim

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.6 Conclusions and Discussion<br />

Computationally fast programs can be achieved by not only introducing parallel programming<br />

techniques into an implementation, but also accelerating the sequential parts of the implementation.<br />

When a data structure is accessed for its entities frequently, the type of data structure has a<br />

prominent effect on performance. The sequential implementation of the traffic flow simulation<br />

is improved such that:<br />

Storage for graph data is modified in a way that the STL-map is replaced by STLvector<br />

and the searching algorithm is modified to use binary search. The performance<br />

gets better by 15-18% compared to the STL-map version.<br />

Storage for parking and waiting queues, on which vehicles at the beginning, are often<br />

accessed and removed, are advanced from the STL-multimap to a user-implemented<br />

singly linked list structure that results in a 9-18% performance increase.<br />

Representation of link cells as an STL-list degrades performance by 13-67% compared<br />

to using the STL-deque. Even better speed-up (40-71% relative to the STLlist)<br />

is achieved when using a user-defined data structure called Ring, which is nothing<br />

but a circular STL-vector composed of pointers to vehicles.<br />

Operations on files depend on the format of data stored in them. The XML-type files<br />

are flexible in terms of management and are elegant, but they usually give worse performance.<br />

The inherent simplicity of structured text files offer better performance but a lack<br />

of flexibility limits their applicability.<br />

The input stream operator >> of C++ promotes easy usage by letting users to not worry<br />

about types of input to be read, but suffers from low performance.<br />

Therefore, the following conclusions are drawn for the best design of MATSIM:<br />

As the graph data, i.e. the links and nodes, being the most frequently accessed data, it is<br />

best represented by the STL-vector. The binary search algorithm of STL should be<br />

used finding an element in the vector structure.<br />

The parking and waiting queues of the links are the data structures which hold the vehicles.<br />

The vehicles on these queues have not started simulating yet either because of full<br />

links or because of travelers performing activities at the location. Removing all the eligible<br />

vehicles at the beginning of these queues prior to inserting them into other queues,<br />

and inserting new vehicles into these queues are best performed on a data structure defined<br />

as a singly linked list so that each vehicle points to another vehicle.<br />

The spatial queues and buffers of the links are best implemented by using a fixed size<br />

vector, elements of which are pointers to vehicles. The movement operations such as<br />

insertion and deletion should be based on pointers to vehicles.<br />

For the input and output data, XML files should be preferred to structured text files since<br />

XML allows constructing user defined complex structures in a more efficient way.<br />

35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!