This paper deals with the application of an optimization procedure based on a statistical cooling algorithm to the computation of the electromagnetic scattering by nonlinear dielectric objects. In particular, a numerical approach is developed that is aimed at determining the electromagnetic field distributions inside these bodies. An integral equation formulation for the scattering by two- and three-dimensional, nonlinear, inhomogeneous, isotropic scatterers of arbitrary shapes is considered. The scatterers are illuminated by time periodic, incident, electric field vectors, and the nonlinear effects are taken into account by introducing equivalent sources. A system of integral equations is obtained that includes the internal electric field distribution as an unknown. After discretization the method consists in treating the problem as an optimization problem in which a nonlinear cost functional is to be minimized. Because of the large number of unknowns and the strong nonlinearity, traditional minimization algorithms would fail to find the global minimum (i.e., the solution of the electromagnetic problem). Therefore the present approach resorts to a statistical cooling procedure based on one walker meandering in the solution space. Some preliminary numerical results are reported concerning scatterers that exhibited Kerrlike nonlinearities.