Does DiffEqFlux.jl supports a constrained optimal control problem, where in both control and states are constrained

I am new to Julia and I am still learning the language.
I thought I could use Julia to solve an Optimal Control problem, which has some constraints. I looked at two examples I found at https://juliahub.com/docs/DiffEqFlux/BdO4p/1.9.0/#example-usage and https://diffeqflux.sciml.ai/dev/examples/optimal_control/.

From sciml_train ( https://diffeqflux.sciml.ai/dev/Scimltrain/ ) documentation I found that there is a box constraint available.

Is it possible to solve the constrained optimal control problem?

Yes, do the same thing except throw the loss function into NLopt.jl with constrained optimization.

Thanks for the reply, but is there any example where can get an insight into solving the problem. I am able to solve a simple unconstrained problem however could not find the syntax for adding the constraints for optimal control problem. Any pointers would be much appreciated.

Instead of using sciml_train there, you can do a direct construction of NLopt.jl objective function and use Zygote.gradient to compute the gradient.