From e2105ca3fbf6d9bb4dac05384d0067fa02b9f63a Mon Sep 17 00:00:00 2001 From: lassepe Date: Thu, 7 Mar 2024 21:19:22 +0100 Subject: [PATCH] yagni: Get rid of unused temporal structure trait logic --- src/TrajectoryGamesBase.jl | 13 +------------ src/dynamics.jl | 12 ------------ src/product_dynamics.jl | 7 ------- test/runtests.jl | 3 --- 4 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/TrajectoryGamesBase.jl b/src/TrajectoryGamesBase.jl index e561a70..dca3764 100644 --- a/src/TrajectoryGamesBase.jl +++ b/src/TrajectoryGamesBase.jl @@ -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 diff --git a/src/dynamics.jl b/src/dynamics.jl index dae5cb5..726e6d9 100644 --- a/src/dynamics.jl +++ b/src/dynamics.jl @@ -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]). diff --git a/src/product_dynamics.jl b/src/product_dynamics.jl index 4a2cc4c..779783a 100644 --- a/src/product_dynamics.jl +++ b/src/product_dynamics.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index ff9bf7d..a73bd34 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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