Self-programming networks : architecture and algorithms