The goal of this paper is the optimization of the design of electrical wheels. For this, a new approach that generates automatically the optimization software is used. It allows to make the design with an elaborated analytical model of the structure chosen for the wheel, Thus it is possible to obtain a very efficient optimization program. This will be illustrated on the example of an electrical wheel for a bicycle.