Optimization methods for compound poisson risk processes