This program covers our optimization techniques in FEM, it is written mainly in FEniCS and scipy. For further details look at scripts at scripts directory.
I do not recommend using the setup.py to install the FEniCSopt package directly, under many different circumstances it could be better to rather run the scripts directly from the highest level. Then you can run them, they see all the libraries in lower levels.