We suggest an approach for finding the maximal and the minimal spectral radius of linear operators from a given compact family of operators, which share a common invariant cone (e.g. for a family of nonnegative matrices). In case of families with so-called product structure, this leads to efficient algorithms for optimizing the spectral radius and for finding the joint and lower spectral radii of the family. Applications to the theory of difference equations and to problems of optimizing the spectral radius of graphs are considered.