Skip to content

Commit

Permalink
yagni: Get rid of unused temporal structure trait logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lassepe committed Mar 7, 2024
1 parent 6b036de commit e2105ca
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 34 deletions.
13 changes: 1 addition & 12 deletions src/TrajectoryGamesBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,7 @@ using GeometryBasics: GeometryBasics
using Polyhedra: Polyhedra

include("dynamics.jl")
export AbstractTemporalStructureTrait,
control_bounds,
control_dim,
get_constraints_from_box_bounds,
horizon,
num_players,
rollout,
state_bounds,
state_dim,
temporal_structure_trait,
TimeInvariant,
TimeVarying
export control_bounds, control_dim, get_constraints_from_box_bounds, horizon, num_players, rollout, state_bounds, state_dim

include("product_dynamics.jl")
export ProductDynamics
Expand Down
12 changes: 0 additions & 12 deletions src/dynamics.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
abstract type AbstractTemporalStructureTrait end
struct TimeVarying <: AbstractTemporalStructureTrait end
struct TimeInvariant <: AbstractTemporalStructureTrait end

"""
temporal_structure_trait(object)
Returns an `AbstractTemporalStructureTrait` to signal if this object (e.g. strategy or dynamics) is
time varying or not.
"""
function temporal_structure_trait end

"""
dynamics(state, controls[, t, context]).
Expand Down
7 changes: 0 additions & 7 deletions src/product_dynamics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,3 @@ end
function horizon(dynamics::ProductDynamics)
horizon(first(dynamics.subsystems))
end

function temporal_structure_trait(dynamics::ProductDynamics)
if all(sub -> temporal_structure_trait(sub) isa TimeInvariant, dynamics.subsystems)
return TimeInvariant()
end
TimeVarying()
end
3 changes: 0 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ end # Mock module
@test control_dim(linear_dynamics) == control_dim(game.dynamics) == 4
@test control_dim(linear_dynamics, 1) == control_dim(game.dynamics, 1) == 2
@test num_players(linear_dynamics) == num_players(game.dynamics) == 2
@test temporal_structure_trait(linear_dynamics) ==
temporal_structure_trait(game.dynamics) ==
TimeInvariant()
end

@testset "cost" begin
Expand Down

0 comments on commit e2105ca

Please sign in to comment.