Skip to content
Snippets Groups Projects
Commit 3344e577 authored by tuhe's avatar tuhe
Browse files

Minor fixes in code documentation

parent 1af4a145
No related branches found
No related tags found
No related merge requests found
Showing
with 5 additions and 3 deletions
...@@ -131,14 +131,17 @@ def collocate(model : ControlModel, N=25, optimizer_options=None, guess : dict = ...@@ -131,14 +131,17 @@ def collocate(model : ControlModel, N=25, optimizer_options=None, guess : dict =
timer = Timer(start=True) timer = Timer(start=True)
cost = model.get_cost() cost = model.get_cost()
t0, tF = sym.symbols("t0"), sym.symbols("tF") 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 = [], [] xs, us = [], []
for i in range(N): for i in range(N):
xs.append(list(symv("x_%i_" % i, model.state_size))) xs.append(list(symv("x_%i_" % i, model.state_size)))
us.append(list(symv("u_%i_" % i, model.action_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 ''' ''' (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 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]. # 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*. # They should be lists of *numbers*.
...@@ -156,7 +159,6 @@ def collocate(model : ControlModel, N=25, optimizer_options=None, guess : dict = ...@@ -156,7 +159,6 @@ def collocate(model : ControlModel, N=25, optimizer_options=None, guess : dict =
raise NotImplementedError("Updates for x_k, u_k") 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). """ """ 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. # TODO: 2 lines missing.
raise NotImplementedError("Updates for t0, tF") raise NotImplementedError("Updates for t0, tF")
assert len(z) == len(z0) == len(z_lb) == len(z_ub) assert len(z) == len(z0) == len(z_lb) == len(z_ub)
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment