When evolutionary algorithms are used for solving numerical constrained optimization problems, how to deal with the relationship between feasible and infeasible individuals can directly influence the final results. This paper proposes a novel ecology-inspired EA to balance the relationship between feasible and infeasible individuals. According to the feasibility of the individuals, the population is divided into two groups, feasible group and infeasible group. The evaluation and ranking of these two groups are performed separately. The number of parents from feasible group has a sigmoid relation with the number of feasible individuals, which is inspired by the ecological population growth in a confined space. The proposed method is tested using (µ, λ) evolution strategies with 13 benchmark problems. Experimental results show that the proposed method is capable of improving performance of the dynamic penalty method for constrained optimization problems.