Routing for autonomous robots in dynamic human environments requires paths that are collision-free, efficient, and socially considerate. This article introduces an optimization-based routing method that operates in continuous space using a spatial-temporal model of crowd dynamics. Our approach anticipates future crowd changes and adjusts routes by considering potential speed variations due to local motion planning. It optimizes navigation speed while avoiding densely crowded areas, ensuring efficient and socially-aware navigation. Simulations in three scenarios demonstrate superior performance compared to benchmark methods in terms of navigation efficiency and adaptability in crowded, dynamic environments.