Abstract : This work deals with the formulation and numerical solution of a nonlinear optimization problem, with discontinuous constraint, in the context of energy harvesting. This optimization problem, which seeks to find a suitable configuration of parameters that maximize the electrical power recovered by a bi-stable energy harvesting device, is formulated in terms of the harvesting dynamical system response and a classifier obtained from 0-1 test for chaos. A stochastic strategy of solution, combining penal-ization and cross-entropy CE method is proposed and tested numerically. The results illustrate the effectiveness of the proposed optimization strategy when compared to a reference solution obtained with a standard exhaustive search in a very fine grid.