The optimal allocation of integrated energy system capacity based on the heuristic algorithms can reduce economic costs and achieve maximum consumption of renewable energy, which has attracted many attentions. However, the optimization results of heuristic algorithms are usually influenced by the choice of hyperparameters. To solve the above problem, the particle swarm algorithm is introduced to find the optimal hyperparameters of the heuristic algorithms. Firstly, an integrated energy system consisting of the photovoltaic, wind turbine, electrolysis cell, hydrogen storage tank, and energy storage is established. Meanwhile, the minimum economic cost, the maximum wind and PV power consumption rate, and the minimum load shortage rate are considered to be the objective functions. Then, a hybrid method combined the particle swarm combined with non-dominated sorting genetic algorithms-II is proposed to solve the optimal allocation problem. According to the optimal result, the economic cost is 6.3 million RMB, and the load shortage rate is 9.83%. Finally, four comparative experiments are conducted to verify the superiority-seeking ability of the proposed method. The comparative results indicate that the proposed method possesses a stronger merit-seeking ability, resulting in a solution satisfaction rate of 87.37%, which is higher than that of the unimproved non-dominated sorting genetic algorithms-II.