To keep up with constantly growing user demands for services with higher quality and bandwidth requirements, telecommunication operators are forced to upgrade their networks. This upgrade, or migration of the network to a new technology, is a complex strategic network planning problem that involves techno-economic evaluations over multiple periods of time. The state-of-the-art approaches consider migrations to a concrete architecture and do not take uncertainties, such as user churn, into account. This results in migration cost underestimations and profitability over-estimations. In this paper, we propose a generic migration algorithm derived from a search based rational agent decision process that can deal with uncertainties and provides the migration path using a maximized utility function. The algorithm maximizes the migration project profitability, measured as accumulated Net Present Value (NPV). This flexible and generic methodology has been evaluated on the example of migration from existing copper networks to the future-proof Passive Optical Network (PON) architectures. Our proposed flexible migration algorithm is validated over pure residential and converged scenarios in a fully reproducible case study. The results yeld that the migration flexibility is a key to the profit maximization.