This paper designs a class of generalized density function and from which proposed a solution method for the multivariable nonlinear optimization problem based on MCMC statistical sampling. Theoretical analysis proved that the maximum statistic converge to the maximum point of probability density which establishing links between the optimization and MCMC sampling. This statistical computation algorithm demonstrates convergence property of maximum statistics in large samples and it is global search design to avoid on local optimal solution restrictions. The MCMC optimization algorithm has less iterate variables reserved so that the computing speed is relatively high. Finally, the MCMC sampling optimization algorithm is applied to solve TSP problem and compared with genetic algorithms.