In this paper, the authors show the optimization problem of line structure (primarily railroad) routing. The improved mathematical models and algorithms of vertical alignment by set versions of the route plan are offered. The problem is solved in some stages in interrelation with other design problems. The original algorithm of descent is given for solving the arising problem of nonlinear programming. Structural features of constraints are used and so it is not required to solve any systems of linear equations.