Skip to content

Non-live attributes in Python (and cpp-mode wrapper) #354

Description

@toruseo

Background

Follow-up to #350 / #352. Since #352, cpp-mode wrapper parameters are live read/write properties backed by the C++ engine ("C++ is the single source of truth"). Some attributes intentionally remain Python-side, and are documented here so the design decision (and its caveats) is visible.

Inert bookkeeping attributes on Link

free_flow_speed, jam_density, jam_density_per_lane, q_star, and k_star are plain Python attributes on the cpp-mode wrapper: snapshots taken at construction and refreshed only by change_free_flow_speed() / change_jam_density().

This exactly mirrors the Python backend, where the simulation reads u, kappa, tau, w, capacity, delta, delta_per_lane and treats the above attributes as records. Consequently, in both backends:

Possible resolutions (any of these; applies to both backends to keep 1:1 semantics):

  • make free_flow_speed/jam_density read-only aliases (properties) of u/kappa, and q_star/k_star computed properties, or
  • make assigning them delegate to change_free_flow_speed()/change_jam_density(), or
  • keep the current semantics and document that u/kappa and the change_*() methods are the authoritative interface

Suggested action

Primarily a documentation/design-decision issue rather than a bug: all of the above is backend-consistent today. Opening this to decide whether to (a) document the authoritative interfaces, or (b) tighten the semantics in both backends as sketched above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions