How to set complex constraints

Hi :wave:

This is Python version
I wanna know if I can set some complex constraints for MPC as I did by using casadi like this:
opti.subject_to(h(opt_states[i+1, :],obstacles[j]) >= (1-gamma_k)*h(opt_states[i, :],obstacles[j]) )
h functions means the Euclidean distance between position x with a obstacle.
The inequility comes from Control Barrier Functions:
h(x_k+1) >= (1-gamma_k) * h(x_k)
which requires state from different time steps.

The reason why I choose to try acados is that the computation speed of casadi is so slow. If the complex constraints doesnโ€™t work in acados, how can I speed up the casadi? Would changing python to cpp work?