  We discuss first order optimality conditions for geometric optimization
problems with Neumann boundary conditions and boundary observation. The methods
we develop here are applicable to large classes of state systems or cost
functionals. Our approach is based on the implicit parametrization theorem and
the use of Hamiltonian systems. It establishes equivalence with a constrained
optimal control problem and uses Lagrange multipliers under a new simple
constraint qualification. In this setting, general functional variations are
performed, that combine topological and boundary variations in a natural way.
