Cost-effective resource allocation