Designing optimal FTTH and PON networks using new automatic methods