Optimization for cycles