Optimization of Robustness of Scale-Free Network to Random and Targeted Attacks