This paper presents a structure of classes based on Object-Oriented Programming, which allows the development of an Optimization Library. In this library, deterministic and stochastic optimization algorithms are considered, as well as algorithms that work with constrained or unconstrained objective functions. First of all, we will present the characteristics of some main optimization methods used in the last years, mainly in the electromagnetic area. Later on, based on these characteristics, we will show the classes created for the implementation of this optimization library. Finally, we will present the communication architecture used for data exchange between this library and a Finite Element Method software.