The goal of this work is to describe an optimization approach for selecting a reduced number of samples of the linear prediction residual. Sample determination is a combinatorial problem. Our approach addresses the combinatorial problem with simulated annealing based optimization. We show that better results than that obtained by a standard approximation approach, namely the multipulse algorithm, are obtained with our approach. Multipulse selects pulse locations by a sequential, sub-optimal, algorithm and computes the pulses amplitudes according to an optimization criteria. Our approach finds the optimal residual samples by means of an optimization algorithm approach without amplitudes optimization. The compressed residual is fed to an all-pole model of speech obtaining better results than standard Multipulse modeling. We believe that this algorithm could be used as an alternative to other algorithms for medium-rate coding of speech in low complexity embedded devices. In this paper we also discuss performance and complexity issues of the described algorithm.