In order to solve the configuration optimization problem of isolated micro-grid, wind driven generator, photovoltaic, diesel generator and energy storage battery optimization model described in the form of energy flow matching is established, which can flexibly form the node connection relation representing the output of equipment at each time. At the same time, in view of the precocious convergence of swarm intelligence algorithm applied to optimal configuration of micro-grid, a random walk optimization algorithm suitable for optimal configuration of micro-grid is proposed. Guided by reducing the annual comprehensive cost of the system, the algorithm realizes synchronous optimization of continuous variable (equipment output) and integer variable (equipment quantity) by randomly increasing or decreasing the hourly output of equipment. By accepting the differential solution mechanism, the algorithm has the ability to jump out of the local optimal solution and better take into account the global search and local search in the capacity optimization process of micro-grid. Applying the random walk algorithm to the simulation example, the annual comprehensive cost is 552 826.39 yuan. Compared with particle swarm optimization algorithm, a better result is obtained. The superiority of the algorithm in optimization accuracy is verified.