In this study, we propose a model to minimize the inventory and location costs of a supply chain, including a production plant, warehouses and retailers. The production plant distributes a single product to retailers through warehouses. The model determines the location of warehouses, allocates retailers to the warehouses and indicates the length of order intervals at warehouses and retailers. To ensure the order quantity is lower than the warehouses' capacity, we consider the capacity constraints. Unlike the existing researches, we investigate the limitation on the number of established warehouses. We formulize the problem as a nonlinear mixed-integer model and propose two efficient meta-heuristic algorithms including a genetic algorithm (GA) and an evolutionary simulated annealing algorithm (ESA) to solve it. To improve the proposed algorithms, in generating populations, a new heuristic method which produces feasible solutions is designed. The Taquchi method is used for tuning the parameters of the proposed