pyomeca / bioptim

An optimization framework that links CasADi, Ipopt, ACADOS and biorbd for Optimal Control Problem
MIT License
95 stars 47 forks source link

Invalid dimension when warmstart #752

Open mickaelbegon opened 1 year ago

mickaelbegon commented 1 year ago

In arm_reaching_torque_driven_collocations.py, I tried to do a warm start after 20 iterations of hessian=limited memory.

    sol_socp = socp.solve(solver)

    socp.set_warm_start(sol_socp)

    # sol_socp.graphs()
    solver.set_maximum_iterations(1000)
    solver.set_hessian_approximation("exact")

    sol_socp = socp.solve(solver)

I got the following error. Is it related to the change in number of controls (last node)?

v_init = interface.ocp.init_vector

File "/Users/mickaelbegon/Documents/GIT/bioptim/bioptim/optimization/optimal_control_program.py", line 819, in init_vector return OptimizationVectorHelper.init_vector(self) File "/Users/mickaelbegon/Documents/GIT/bioptim/bioptim/optimization/optimization_vector.py", line 338, in init_vector nlp.u_init[key].check_and_adjust_dimensions(nlp.controls[key].cx.shape[0], ns - 1) File "/Users/mickaelbegon/Documents/GIT/bioptim/bioptim/limits/path_conditions.py", line 734, in check_and_adjust_dimensions self.init.check_and_adjust_dimensions(n_elements, n_shooting, "InitialGuess") File "/Users/mickaelbegon/Documents/GIT/bioptim/bioptim/limits/path_conditions.py", line 246, in check_and_adjust_dimensions raise RuntimeError( RuntimeError: Invalid number of column for InterpolationType.EACH_FRAME (ncols = 80), the expected number of column is 81