# How to set convex-over-nonlinear constraints

Hi

I’d like to ask how to set con_phi_expr and con_r_expr when adding convex-over-nonlinear constraints.

For a simple example, let’s say we have 3 state variables x_1, x_2, x_3. I want to set 2 constraints: x_1^2 + x_2^2 \leq 1 and x_2^2 + x_3^2 \leq 2.

First, I’d like to confirm does these 2 constraints satisfy the requirements of convex-over-nonlinear? I think it does because taking the 2-norm is a convex function.

Second, if the answer is yes, how should I express con_phi_expr and con_r_expr in Python interface?

Any help will be much appreciated! Besides, it would be nice if you tell if there’s any example containing convex-over-nonlinear constraints in the acados repo. Thanks!

Best,
Fenglong

Hi

here is an example:

1 Like