Skip to content

Mechanical get_bounds tree-walk over named ps #94

Description

@AlCap23

What to build

With bounds now living directly on each ControlParameter (#92) and TunableParameter (#93) leaf, implement get_bounds as a pure tree-walk over a named ps-shaped NamedTuple (e.g. (; u0 = (node1 = (;x₁=...), ...), controls = (; k=..., u₁=...))), pulling .bounds off each leaf and returning (lb, ub) with exactly the same nested shape as ps itself.

There should be no separate bounds-shaped data structure to keep in sync — lb/ub fall out mechanically from mapping "extract bounds" over the same tree that ps already is, so whatever vectorizer (e.g. the ComponentArrays extension) flattens ps for the optimizer can flatten lb/ub identically.

Acceptance criteria

  • get_bounds(ps) returns (lb, ub) congruent in shape/keys to ps
  • Works uniformly over ControlParameter and TunableParameter leaves without per-type special-casing at call sites
  • Unit tests verify shape congruence and correct bound extraction for nested u0/controls trees

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions