Optimal Resource Allocation in Wireless Networks