Acados re-initialization of ocp

I ran a simulation with a certain cost function for 5 seconds. Then taking the initial condition after 5 seconds, I ran another simulation with a different cost function for 15 seconds. When they were in separate files and I used the end condition of the first simulation as the initial condition for the second simulation everything works fine. I tried placing them in the same loop and using a parameter to switch between cost functions but this yields different results. I believe I need to reset all initializations of solver when I switch between cost functions. Hence my question, How does acados initialize the solver when it just starts?
Thank you