I am working on an ocp-nlp problem.
My approach is to write the model and solution scripts in Python, then supplement the data (the supplemented data includes yref, x_init etc.) for the main_xxx.c files in c_generated_code, before running the C program to solve.
Some options under python are:
ocp.solver_options.integrator_type = ‘ERK’
ocp.solver_options.sim_method_num_stages = 2
ocp.solver_options.gnsf_detect_struct = ‘false’
ocp.solver_options.nlp_solver_type = ‘SQP’
ocp.solver_options.tol = 1e-2
ocp.solver_options.qp_solver = ‘PARTIAL_CONDENSING_HPIPM’
ocp.solver_options.qp_solver_iter_max = 3
ocp.solver_options.hessian_approx = ‘EXACT’
But I found that time_tot in C is more than that in Python.
I printed the timing information and it seems that the time_lin and time_sim items take more time in C language compared to Python.
A set of typical time cost is as follows:
So I’m a little confused now …