In a cloud federation, by using the pay-as-you-go billing model users can relinquish their services at any point in time and pay accordingly. Therefore, this thesis aims to study the resource assignment problem in the situation where the user relinquishment impacts the net profit of a cloud service provider. As a solution, our study 1) proposes a tool to calculate the net profit which includes income, electricity expenses, and relinquishment loss; 2) compares different ways to predict the user behavior and deduce a better prediction technique based on linear regression; and 3) proposes a relinquishment-aware resource optimization model to estimate the amount of resources based upon the predicted user behavior. Simulations were performed with the CloudSim framework. The results show that instead of blindly assigning resources to users, a cloud service provider with a finite resource pool can gain more by estimating the resources using better prediction techniques.