Optimization-based structure identification of dynamical networks