diff --git a/examples/Project.toml b/examples/Project.toml new file mode 100644 index 0000000..c8ff2ce --- /dev/null +++ b/examples/Project.toml @@ -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" diff --git a/examples/TrajectoryExamples.jl b/examples/TrajectoryExamples.jl index 47473f6..ebd2a07 100644 --- a/examples/TrajectoryExamples.jl +++ b/examples/TrajectoryExamples.jl @@ -14,7 +14,8 @@ collision-avoidance. """ module TrajectoryExamples -using LevelTwoInverseGames: + +using MCPSolver: ParametricGame, OptimizationProblem, num_players, solve using LazySets: LazySets @@ -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 @@ -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 diff --git a/examples/lane_change.jl b/examples/lane_change.jl index 9dac2ac..2abe265 100644 --- a/examples/lane_change.jl +++ b/examples/lane_change.jl @@ -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,