diff --git a/irlc/ex05/direct.py b/irlc/ex05/direct.py index 3196e9b0c60f2619b73ef11b727e3f3bb01e0dab..85eb4d2b15212a809ba18c55e103312869e56ce2 100644 --- a/irlc/ex05/direct.py +++ b/irlc/ex05/direct.py @@ -131,14 +131,17 @@ def collocate(model : ControlModel, N=25, optimizer_options=None, guess : dict = timer = Timer(start=True) cost = model.get_cost() t0, tF = sym.symbols("t0"), sym.symbols("tF") - ts = t0 + np.linspace(0, 1, N) * (tF-t0) # N points linearly spaced between [t0, tF] TODO: Convert this to a list. + ts = t0 + np.linspace(0, 1, N) * (tF-t0) # N points linearly spaced between [t0, tF] + # ts is a list of length N representing the time points, i.e., t_0, t_1, ..., t_{N-1}. Notice these are symbolic + # objects that depend on t0 and tF. + + xs, us = [], [] for i in range(N): xs.append(list(symv("x_%i_" % i, model.state_size))) us.append(list(symv("u_%i_" % i, model.action_size))) ''' (1) Construct guess z0, all simple bounds [z_lb, z_ub] for the problem and collect all symbolic variables as z ''' - # sb = model.simple_bounds() # get simple inequality boundaries in problem (v_lb <= v <= v_ub) z = [] # list of all *symbolic* variables in the problem # These lists contain the guess z0 and lower/upper bounds (list-of-numbers): z_lb[k] <= z0[k] <= z_ub[k]. # They should be lists of *numbers*. @@ -156,7 +159,6 @@ def collocate(model : ControlModel, N=25, optimizer_options=None, guess : dict = raise NotImplementedError("Updates for x_k, u_k") """ Update z, z0, z_lb, and z_ub with bounds/guesses corresponding to t0 and tF (same format as above). """ - # z, z0, z_lb, z_ub = z+[t0], z0+[guess['t0']], z_lb+[model.bounds['t0_low']], z_ub+[model.bounds['t0_high']] # TODO: 2 lines missing. raise NotImplementedError("Updates for t0, tF") assert len(z) == len(z0) == len(z_lb) == len(z_ub) diff --git a/irlc/tests/unitgrade_data/BrachistochroneConstrainedQuestion.pkl b/irlc/tests/unitgrade_data/BrachistochroneConstrainedQuestion.pkl index 7aa357f22284db5a7c18904029c3d5a219504f95..76f27814d4eaaa7c2990d3dab02904f443993ef0 100644 Binary files a/irlc/tests/unitgrade_data/BrachistochroneConstrainedQuestion.pkl and b/irlc/tests/unitgrade_data/BrachistochroneConstrainedQuestion.pkl differ diff --git a/irlc/tests/unitgrade_data/BrachistochroneQuestion.pkl b/irlc/tests/unitgrade_data/BrachistochroneQuestion.pkl index 7aa357f22284db5a7c18904029c3d5a219504f95..76f27814d4eaaa7c2990d3dab02904f443993ef0 100644 Binary files a/irlc/tests/unitgrade_data/BrachistochroneQuestion.pkl and b/irlc/tests/unitgrade_data/BrachistochroneQuestion.pkl differ diff --git a/irlc/tests/unitgrade_data/CartpoleCostQuestion.pkl b/irlc/tests/unitgrade_data/CartpoleCostQuestion.pkl index 7aa357f22284db5a7c18904029c3d5a219504f95..76f27814d4eaaa7c2990d3dab02904f443993ef0 100644 Binary files a/irlc/tests/unitgrade_data/CartpoleCostQuestion.pkl and b/irlc/tests/unitgrade_data/CartpoleCostQuestion.pkl differ diff --git a/irlc/tests/unitgrade_data/CartpoleTimeQuestion.pkl b/irlc/tests/unitgrade_data/CartpoleTimeQuestion.pkl index 7aa357f22284db5a7c18904029c3d5a219504f95..76f27814d4eaaa7c2990d3dab02904f443993ef0 100644 Binary files a/irlc/tests/unitgrade_data/CartpoleTimeQuestion.pkl and b/irlc/tests/unitgrade_data/CartpoleTimeQuestion.pkl differ diff --git a/irlc/tests/unitgrade_data/DirectAgentPendulum.pkl b/irlc/tests/unitgrade_data/DirectAgentPendulum.pkl index 98b491a9b32dc238dd78087d04c3fa9ce9c03376..49ce42c0ea11e0f6f45b5cd1aadccde7c4fb4274 100644 Binary files a/irlc/tests/unitgrade_data/DirectAgentPendulum.pkl and b/irlc/tests/unitgrade_data/DirectAgentPendulum.pkl differ diff --git a/irlc/tests/unitgrade_data/DirectMethods.pkl b/irlc/tests/unitgrade_data/DirectMethods.pkl index 712bc1ba7a02f104591a0e739f8ca250cca92ac6..7ccccf4713076674e8553270c2282b44501b6cc8 100644 Binary files a/irlc/tests/unitgrade_data/DirectMethods.pkl and b/irlc/tests/unitgrade_data/DirectMethods.pkl differ diff --git a/irlc/tests/unitgrade_data/DirectSolverQuestion.pkl b/irlc/tests/unitgrade_data/DirectSolverQuestion.pkl index 7aa357f22284db5a7c18904029c3d5a219504f95..76f27814d4eaaa7c2990d3dab02904f443993ef0 100644 Binary files a/irlc/tests/unitgrade_data/DirectSolverQuestion.pkl and b/irlc/tests/unitgrade_data/DirectSolverQuestion.pkl differ diff --git a/irlc/tests/unitgrade_data/Exam5InventoryEvaluation.pkl b/irlc/tests/unitgrade_data/Exam5InventoryEvaluation.pkl index 6acc01f3a1dbd08669dac4a2667110395d7366fe..12902e7ce8615fda0d3a74fbd97811e28766dded 100644 Binary files a/irlc/tests/unitgrade_data/Exam5InventoryEvaluation.pkl and b/irlc/tests/unitgrade_data/Exam5InventoryEvaluation.pkl differ diff --git a/irlc/tests/unitgrade_data/Exam6Toy2d.pkl b/irlc/tests/unitgrade_data/Exam6Toy2d.pkl index 240e9b95f3b8fd8c7e2f91e5cf7319603d7bd8f1..d40a08b78e3defd5e720b05e0948e20d9ad0f3b8 100644 Binary files a/irlc/tests/unitgrade_data/Exam6Toy2d.pkl and b/irlc/tests/unitgrade_data/Exam6Toy2d.pkl differ diff --git a/irlc/tests/unitgrade_data/ExamQuestion7FlowersStore.pkl b/irlc/tests/unitgrade_data/ExamQuestion7FlowersStore.pkl index 031d3029785aa0d7e137970e0cf5c45aab708d3f..50149f3db947fddf5f0faf61a7f098e1fc8a3167 100644 Binary files a/irlc/tests/unitgrade_data/ExamQuestion7FlowersStore.pkl and b/irlc/tests/unitgrade_data/ExamQuestion7FlowersStore.pkl differ diff --git a/irlc/tests/unitgrade_data/PendulumQuestion.pkl b/irlc/tests/unitgrade_data/PendulumQuestion.pkl index 7aa357f22284db5a7c18904029c3d5a219504f95..76f27814d4eaaa7c2990d3dab02904f443993ef0 100644 Binary files a/irlc/tests/unitgrade_data/PendulumQuestion.pkl and b/irlc/tests/unitgrade_data/PendulumQuestion.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem1BobsFriend.pkl b/irlc/tests/unitgrade_data/Problem1BobsFriend.pkl index 8cabb23936fc5500a2a2f960d1ee63e073f80ec9..62c9f65ce0617aa3054d6affdad0c711fc5685c7 100644 Binary files a/irlc/tests/unitgrade_data/Problem1BobsFriend.pkl and b/irlc/tests/unitgrade_data/Problem1BobsFriend.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem1DiscreteKuromoto.pkl b/irlc/tests/unitgrade_data/Problem1DiscreteKuromoto.pkl index d99b4f1f706db62e81a0c95ea55659159ae50e2e..9b686f94b8f574600bc3a37c18a45c4d0a299430 100644 Binary files a/irlc/tests/unitgrade_data/Problem1DiscreteKuromoto.pkl and b/irlc/tests/unitgrade_data/Problem1DiscreteKuromoto.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem1Kuramoto.pkl b/irlc/tests/unitgrade_data/Problem1Kuramoto.pkl index 4a6d5ddc1e76deb9ffe861a07a42a132404b41c4..cf285336e8f17dae0bab7e7270a857852e1ba420 100644 Binary files a/irlc/tests/unitgrade_data/Problem1Kuramoto.pkl and b/irlc/tests/unitgrade_data/Problem1Kuramoto.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem2BobsPolicy.pkl b/irlc/tests/unitgrade_data/Problem2BobsPolicy.pkl index 2deabbf0f7156fd8ae2154bb11eb3b289752cf38..7023764ccbc227ca96f484b63afdabaa14f9483e 100644 Binary files a/irlc/tests/unitgrade_data/Problem2BobsPolicy.pkl and b/irlc/tests/unitgrade_data/Problem2BobsPolicy.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem2DeterministicDP.pkl b/irlc/tests/unitgrade_data/Problem2DeterministicDP.pkl index f07ee5608303792b66af5da86ffc1e86a2662674..ad9b4003fc5167a0e32093f6add6c9564bb3abd6 100644 Binary files a/irlc/tests/unitgrade_data/Problem2DeterministicDP.pkl and b/irlc/tests/unitgrade_data/Problem2DeterministicDP.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem2DeterministicInventory.pkl b/irlc/tests/unitgrade_data/Problem2DeterministicInventory.pkl index e681d4c3aec5f223b6448415bcb939b3cf2bf90f..7316c88b930645edd82ccc62f437a80b134c2230 100644 Binary files a/irlc/tests/unitgrade_data/Problem2DeterministicInventory.pkl and b/irlc/tests/unitgrade_data/Problem2DeterministicInventory.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem3InventoryInventoryEnvironment.pkl b/irlc/tests/unitgrade_data/Problem3InventoryInventoryEnvironment.pkl index d1d359cba9654c738636b38e613728f1f04f0779..efa02d1d079347d5441874bc597c4e187d31bc71 100644 Binary files a/irlc/tests/unitgrade_data/Problem3InventoryInventoryEnvironment.pkl and b/irlc/tests/unitgrade_data/Problem3InventoryInventoryEnvironment.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem3PID.pkl b/irlc/tests/unitgrade_data/Problem3PID.pkl index 6a51d18fc3f2b36532f81ed15bea1502175b3323..8c6beb7a36898495ec6e53b18524f5710a900457 100644 Binary files a/irlc/tests/unitgrade_data/Problem3PID.pkl and b/irlc/tests/unitgrade_data/Problem3PID.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem3StochasticDP.pkl b/irlc/tests/unitgrade_data/Problem3StochasticDP.pkl index 87086b64dc45068321f8f0b6bd057d56941535b4..929b45dc8d15fa1f4ae023ee1b060091fb8247af 100644 Binary files a/irlc/tests/unitgrade_data/Problem3StochasticDP.pkl and b/irlc/tests/unitgrade_data/Problem3StochasticDP.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem4DPAgent.pkl b/irlc/tests/unitgrade_data/Problem4DPAgent.pkl index af0487d9dc1df9199dabc0ecaf2d754798d897bb..b98533150232f5c5315c7b14033536777ce90a8f 100644 Binary files a/irlc/tests/unitgrade_data/Problem4DPAgent.pkl and b/irlc/tests/unitgrade_data/Problem4DPAgent.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem4InventoryTrain.pkl b/irlc/tests/unitgrade_data/Problem4InventoryTrain.pkl index 74fcddc08e55ea7b69f8cb606dc5f40aaef49272..6228dc12a502006cdf951286048d93936bea9dfe 100644 Binary files a/irlc/tests/unitgrade_data/Problem4InventoryTrain.pkl and b/irlc/tests/unitgrade_data/Problem4InventoryTrain.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem4PIDAgent.pkl b/irlc/tests/unitgrade_data/Problem4PIDAgent.pkl index 5adbc5bc1f74a2cf5b06cc117bf69240cbfec35c..b3daba6609d47b6033fa62fa6963bb89fcae2543 100644 Binary files a/irlc/tests/unitgrade_data/Problem4PIDAgent.pkl and b/irlc/tests/unitgrade_data/Problem4PIDAgent.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem5PacmanHardcoded.pkl b/irlc/tests/unitgrade_data/Problem5PacmanHardcoded.pkl index 2947df4c97912b5211787ecc1eb0f03700223e20..04ac143368d1c4eb5280b4166b9da0f4e3eb3701 100644 Binary files a/irlc/tests/unitgrade_data/Problem5PacmanHardcoded.pkl and b/irlc/tests/unitgrade_data/Problem5PacmanHardcoded.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem6ChessTournament.pkl b/irlc/tests/unitgrade_data/Problem6ChessTournament.pkl index ba99a0cfb5a009525699b0bf7bff4a31720bc719..ebeda311cb01e4d60077598cb655e5368f5bcdda 100644 Binary files a/irlc/tests/unitgrade_data/Problem6ChessTournament.pkl and b/irlc/tests/unitgrade_data/Problem6ChessTournament.pkl differ diff --git a/irlc/tests/unitgrade_data/Problem7PIDCar.pkl b/irlc/tests/unitgrade_data/Problem7PIDCar.pkl index 06fafcc61cee7324b50480a1cfe9256e26fda562..bfe010445cb8af018fe5e956ef043b34a34dba89 100644 Binary files a/irlc/tests/unitgrade_data/Problem7PIDCar.pkl and b/irlc/tests/unitgrade_data/Problem7PIDCar.pkl differ