This article describes the method of magnetic field topology optimization in an axisymmetric three-dimensional finite region. It is assumed that the region of interest is surrounded by a cylindrical solenoid with an electrical current. The solenoid's inner and outer surfaces are built-up by rotating plane Bezier curves around the symmetry axis. As a global minimizer a genetic algorithm method is used. Optimal configurations are provided under given constraints.