MengeCrowdSim / Menge

The source code for the Menge crowd simulation framework
Apache License 2.0
139 stars 64 forks source link

Extend output file data/format #75

Open curds01 opened 6 years ago

curds01 commented 6 years ago

Background

Currently, agent trajectories can be output for later analysis by writing to an "scb" file. There are several versions of the scb file: 1.0, 2.0, 2.1, 2.2, 2.3, & 2.4. The files consist of a header and a per-frame body. The major version indicates a common header, and the minor version indicates a unique collection of per-frame data. In all cases, the data is a subset of what is available to the BaseAgent class (e.g., position, orientation, velocity, state).

Problem Statement

The output file needs to be extensible to allow downstream users to amend what gets written to the file. This includes a larger space of the common agent parameters as well as values that are unique to agent implementations.

For example, it might be worthwhile to list the agents that are considered an agent's neighbor (for computational purposes). Or, when outputting a force-based agent, it might be desirable to output calculated forces (per neighboring agent and obstacle).

Proposed Solution

Introduce two new elements and a mechanism for invoking them. The first element is a header writer. The second is a per-frame (possibly per-agent) serializer. The output writer is then assembled by selecting a header and per-frame writer.

Design issues

  1. The mix-and-match approach of header-frame data can lead to files that are inconsistent (e.g., the per-frame data could have indices that were never defined in the header).
    1. This could be addressed by only specifying the frame writer, and have the frame writer declare a header dependency.
  2. This could lead to an explosion of data types that cannot be generally parsed (if the format is not known a priori.) Generally, these can't/won't be supported by (https://github.com/curds01/MengeUtils).
  3. Extend the project specification to select output version. At that point, it is probably worth distinguishing between the menge supported "scb" file and anything that isn't "stock".