Implement a new optimization algorithm

Hello, I am a student using FEniCS. I hope to use FEniCS to implement a new optimization algorithm. I hope to use the deep reinforcement learning method to replace the adjoint method to optimize the shape, but I encountered difficulties in implementing this code.
I hope to optimize some parameters through deep reinforcement learning, and then use the parameters to change the shape of the mesh. But the ALE method in FEniCS needs to solve the entire mesh area. I hope to change the shape of the mesh through some scalar parameters, which are easy to obtain and change. Those parameters may be an array. Can you give some advice? Is there such a scalar parameter in FEniCS that allows me to easily change the mesh shape? Thank you for your help.

Dear @whitesky,

You need to be more specific when say that you would use some parameters to change the mesh.
In particular, are these parameters rotation, translation or scaling?
If not, you need to explain what the parameters should intend to do.

You can also consider the approach shown in the Stokes-shape optimization example, where the control variable consists of only the boundary nodes of the mesh (which in turn can be interpreted as a traction applied on the mesh boundary, or as a direct deformation, depending on the way you enforce the boundary condition for the deformation scheme).