measure postprocessing time
This commit is contained in:
parent
9dfc06169f
commit
67405fbd3f
|
@ -139,6 +139,7 @@ class OpenLoopSolver:
|
||||||
|
|
||||||
|
|
||||||
def solve(self, x0, target, obstacles):
|
def solve(self, x0, target, obstacles):
|
||||||
|
tstart = time.time()
|
||||||
# alternative solution using multiple shooting (way faster!)
|
# alternative solution using multiple shooting (way faster!)
|
||||||
self.opti = Opti() # Optimization problem
|
self.opti = Opti() # Optimization problem
|
||||||
|
|
||||||
|
@ -163,10 +164,6 @@ class OpenLoopSolver:
|
||||||
#self.opti.set_initial(speed, 1)
|
#self.opti.set_initial(speed, 1)
|
||||||
#self.opti.set_initial(T, 1)
|
#self.opti.set_initial(T, 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tstart = time.time()
|
|
||||||
x = SX.sym('x')
|
x = SX.sym('x')
|
||||||
y = SX.sym('y')
|
y = SX.sym('y')
|
||||||
theta = SX.sym('theta')
|
theta = SX.sym('theta')
|
||||||
|
@ -259,6 +256,7 @@ class OpenLoopSolver:
|
||||||
tend = time.time()
|
tend = time.time()
|
||||||
print("solving the problem took {} seconds".format(tend - tstart))
|
print("solving the problem took {} seconds".format(tend - tstart))
|
||||||
|
|
||||||
|
tstart = time.time()
|
||||||
self.opti_x0 = sol.value(self.opti.x)
|
self.opti_x0 = sol.value(self.opti.x)
|
||||||
self.opti_lam_g0 = sol.value(self.opti.lam_g)
|
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_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_1 = sol.value(self.U[0,:])
|
||||||
u_opt_2 = sol.value(self.U[1,:])
|
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))
|
return (u_opt_1, u_opt_2, sol.value(posx), sol.value(posy))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user