Optimization and Heuristics for Cognitive Radio Design