Particle density retrieval in random media using a percolation model and a particle swarm optimizer