8000 [Feature]: Allow `exclude` in merge trajectories · Issue #77 · harmoniqs/NamedTrajectories.jl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content 8000
[Feature]: Allow exclude in merge trajectories #77
Closed
@andgoldschmidt

Description

@andgoldschmidt

Feature Description

In this call:

function add_suffix(traj::NamedTrajectory, suffix::String)
    # Timesteps are appended because of bounds and initial/final constraints.
    component_names = vcat(traj.state_names..., traj.control_names...)
    components = add_suffix(component_names, traj, suffix)
    controls = add_suffix(traj.control_names, suffix)
    return NamedTrajectory(
        components;
        controls=controls,
        timestep=traj.timestep isa Symbol ? add_suffix(traj.timestep, suffix) : traj.timestep,
        bounds=add_suffix(traj.bounds, suffix),
        initial=add_suffix(traj.initial, suffix),
        final=add_suffix(traj.final, suffix),
        goal=add_suffix(traj.goal, suffix)
    )
end

there is no way to exclude certain symbols.

Other, underlying calls, allow for exclusion:

function add_suffix(
    nt::NamedTuple, 
    suffix::String; 
    exclude::AbstractVector{<:Symbol}=Symbol[]
)
    symbs = Tuple(k  exclude ? k : add_suffix(k, suffix) for k  keys(nt))
    return NamedTuple{symbs}(values(nt))
end

It would be nice to have exclusion so, e.g. timesteps can be merged successfully using the merge call.

Importance

1 (lowest)

What does this feature affect?

  • construction
  • methods
  • plotting
  • documentation
  • tests
  • other (please specify below)

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0