In this paper, we propose an algorithm for allocation of sensor nodes and base stations in inhomogeneous propagation environments. First, we review 1-ray and 2-ray models with amplitude modification factor α and propagation order of distance β. Second, we introduce an equation to compute communication distance. Third, we propose a communication distance function to allocate base stations optimally based on PSO. In numerical examples, we show an adaptive algorithm for generating inhomogeneous triangular cells to achieve optimal allocations of base stations.