From 52abfb9fd40ac3007c2b605fb962969a2be193f1 Mon Sep 17 00:00:00 2001 From: ceglia Date: Mon, 15 Nov 2021 09:20:18 -0500 Subject: [PATCH 1/2] Auto stash before merge of "main" and "s2mLab/main" --- pointing/generate_table.py | 54 ++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/pointing/generate_table.py b/pointing/generate_table.py index bcbf25c..3acf65e 100644 --- a/pointing/generate_table.py +++ b/pointing/generate_table.py @@ -18,34 +18,36 @@ def generate_table(out): else: weights = np.array([100, 1, 1, 100000, 1]) if not use_ipopt else np.array([100, 1, 1, 100000, 1]) - for ode_solver in [OdeSolver.RK4(), OdeSolver.COLLOCATION()]: - if not use_ipopt and isinstance(ode_solver, OdeSolver.COLLOCATION): - continue + for i, ode_solver in enumerate([OdeSolver.RK4(), OdeSolver.COLLOCATION()]): + if use_ipopt is False and i == 1: + pass + else: + biorbd_model_ip = biorbd.Model(model_path) + ocp = prepare_ocp( + biorbd_model=biorbd_model_ip, + final_time=2, + n_shooting=200, + use_sx=not use_ipopt, + weights=weights, + use_excitations=use_excitations, + ode_solver=ode_solver + ) + if use_ipopt: + solver = Solver.IPOPT() + solver.set_linear_solver("ma57") + solver.set_tol(1e-8) + solver.set_hessian_approximation("exact") + solver.set_print_level(0) - biorbd_model_ip = biorbd.Model(model_path) - ocp = prepare_ocp( - biorbd_model=biorbd_model_ip, - final_time=2, - n_shooting=200, - use_sx=not use_ipopt, - weights=weights, - use_excitations=use_excitations, - ode_solver=ode_solver - ) - if use_ipopt: - solver = Solver.IPOPT() - solver.set_linear_solver("ma57") - solver.set_hessian_approximation("exact") - solver.set_print_level(0) + elif not use_ipopt: + solver = Solver.ACADOS() + solver.set_sim_method_num_steps(5) + solver.set_convergence_tolerance(1e-8) + solver.set_maximum_iterations(1000) + solver.set_integrator_type("IRK") + solver.set_hessian_approx("GAUSS_NEWTON") + solver.set_print_level(0) - else: - solver = Solver.ACADOS() - solver.set_sim_method_num_steps(5) - solver.set_convergence_tolerance(1e-8) - solver.set_maximum_iterations(1000) - solver.set_integrator_type("ERK") - solver.set_hessian_approx("GAUSS_NEWTON") - solver.set_print_level(0) # --- Solve the program --- # tic = time() From 7a991411a8a22b12cdb894ffca0e713dbec7c819 Mon Sep 17 00:00:00 2001 From: ceglia Date: Mon, 15 Nov 2021 09:24:08 -0500 Subject: [PATCH 2/2] Typo modifications --- pointing/generate_table.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pointing/generate_table.py b/pointing/generate_table.py index 3acf65e..289a9e8 100644 --- a/pointing/generate_table.py +++ b/pointing/generate_table.py @@ -39,7 +39,7 @@ def generate_table(out): solver.set_hessian_approximation("exact") solver.set_print_level(0) - elif not use_ipopt: + else: solver = Solver.ACADOS() solver.set_sim_method_num_steps(5) solver.set_convergence_tolerance(1e-8) @@ -48,7 +48,6 @@ def generate_table(out): solver.set_hessian_approx("GAUSS_NEWTON") solver.set_print_level(0) - # --- Solve the program --- # tic = time() sol = ocp.solve(solver)