Skip to content

Commit

Permalink
trying to get examples to not add main pkg deps
Browse files Browse the repository at this point in the history
  • Loading branch information
dfridovi committed Nov 22, 2024
1 parent 98406b1 commit 965d443
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
6 changes: 6 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
LazySets = "b4f0291d-fe17-52bc-9479-3d1a343d9043"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
TrajectoryGamesExamples = "ff3fa34c-8d8f-519c-b5bc-31760c52507a"
25 changes: 2 additions & 23 deletions examples/TrajectoryExamples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ collision-avoidance.
"""

module TrajectoryExamples
using LevelTwoInverseGames:

using MCPSolver:
ParametricGame, OptimizationProblem, num_players, solve

using LazySets: LazySets
Expand All @@ -41,7 +42,6 @@ using TrajectoryGamesExamples: planar_double_integrator, animate_sim_steps
using BlockArrays: mortar, blocks, BlockArray, Block
using GLMakie: GLMakie
using Makie: Makie
using PATHSolver: PATHSolver
using LinearAlgebra: norm_sqr, norm
using ProgressMeter: ProgressMeter

Expand All @@ -57,27 +57,6 @@ export build_parametric_game,
parameter_mask,
generate_initial_guess

"Zygote-friendly trajectory unpacking utility."
function unpack_trajectory_zygote(flat_trajectories; dynamics::ProductDynamics)
horizon = Int(
length(flat_trajectories[1]) /
(state_dim(dynamics, 1) + control_dim(dynamics, 1)),
)

map(1:num_players(dynamics), flat_trajectories) do ii, traj
num_states = state_dim(dynamics, ii) * horizon
X = reshape(traj[1:num_states], (state_dim(dynamics, ii), horizon))
U = reshape(
traj[(num_states + 1):end],
(control_dim(dynamics, ii), horizon),
)

(; xs = eachcol(X) |> collect, us = eachcol(U) |> collect)
end
end

export unpack_trajectory_zygote

include("lane_change.jl")

end # module TrajectoryExamples
2 changes: 0 additions & 2 deletions examples/lane_change.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ function setup_trajectory_game(; environment)
TrajectoryGame(dynamics, cost, environment, coupling_constraints)
end

using Infiltrator

function main(;
initial_state = mortar([[1.0, 1.0, 0.0, 1.0], [3.2, 0.9, 0.0, 1.0]]),
horizon = 10,
Expand Down

0 comments on commit 965d443

Please sign in to comment.