measure postprocessing time

This commit is contained in:
Simon Pirkelmann 2019-06-27 16:30:24 +02:00
parent 9dfc06169f
commit 67405fbd3f

View File

@ -139,6 +139,7 @@ class OpenLoopSolver:
def solve(self, x0, target, obstacles):
tstart = time.time()
# alternative solution using multiple shooting (way faster!)
self.opti = Opti() # Optimization problem
@ -163,10 +164,6 @@ class OpenLoopSolver:
#self.opti.set_initial(speed, 1)
#self.opti.set_initial(T, 1)
tstart = time.time()
x = SX.sym('x')
y = SX.sym('y')
theta = SX.sym('theta')
@ -259,6 +256,7 @@ class OpenLoopSolver:
tend = time.time()
print("solving the problem took {} seconds".format(tend - tstart))
tstart = time.time()
self.opti_x0 = sol.value(self.opti.x)
self.opti_lam_g0 = sol.value(self.opti.lam_g)
@ -266,6 +264,8 @@ class OpenLoopSolver:
#u_opt_2 = map(lambda x: float(x), [u_opt[i * 2 + 1] for i in range(0, 60)])
u_opt_1 = sol.value(self.U[0,:])
u_opt_2 = sol.value(self.U[1,:])
tend = time.time()
print("postprocessing took {} seconds".format(tend - tstart))
return (u_opt_1, u_opt_2, sol.value(posx), sol.value(posy))