Optimal Power Allocation and Scheduling Under Jamming Attacks