A closed-form solution to the Ramsey model with logistic population growth