This paper is the extension of work presented at the IARP Conference "Bio inspired robotics" held in Frascati (Italy), 14 May 2014.The subject is the localization problem of an underwater swarm of autonomous underwater robots (AUV), in the frame of the HARNESS project; by localization, we mean the relative swarm configuration, i.e., the geometrical shape of the group. The result is achieved by using the signals that the robots exchange. The swarm is organized by rules and conceived to perform tasks, ranging from environmental monitoring to terrorism-attack surveillance.Two methods of determining the shape of the swarm, both based on trilateration calculation, are proposed. The first method focuses on the robot's speed. In this case, we use our knowledge of the speeds and distances between the machines, while the second method considers only distances and the orientation angles of the robots. Unlike a trilateration problem, we do not know the position of the beacons and this renders the problem a difficult one. Moreover, we have very few data. More than one step of motion is needed to resolve the multiple solutions found, owing to the symmetries of the system and optimization process of one or more objective functions leading to the final configuration. We subsequently checked our algorithm using a simulator taking into account random errors affecting the measurements.