In this paper, a new version of the particle swarm optimization (PSO) algorithm suitable for discrete optimization problems is presented and applied for the solution of the capacitated location routing problem and for the solution of a new formulation of the location routing problem with stochastic demands. The proposed algorithm combines three different topologies which are incorporated in a constriction particle swarm optimization algorithm and, thus, a very effective new algorithm, the global and local combinatorial expanding neighborhood topology particle swarm optimization, was developed. The algorithm was tested, initially, in the three classic sets of benchmark instances for the capacitated location routing problem with discrete demands and, then, as there are no benchmark instances for the location routing problem with stochastic demands, these instances were transformed appropriately in order to be suitable for the problem with stochastic demands. The algorithm was tested in the problem with the stochastic demands using these transformed sets of benchmark instances. The algorithm was compared with a number of different implementations of the PSO and with metaheuristic, evolutionary and nature inspired algorithms from the literature for the location routing problem with discrete and stochastic demands. 
An improved particle swarm optimization algorithm for the capacitated location routing problem and for the location routing problem with stochastic demands