This is a homework in BUPT Network Design Class. And I would continuely upgate this code.