The most optimal pathfinding strategy varies for different kinds of creeps. Some never leave their parent room; others travel far across the map and through portals.
A harvester spawns and moves to its designated source, following a well-known path (probably with roads). Its preferred destination is the container next to the source; if that is occupied by another harvester, it will move to any position adjacent to the source; if all of those are occupied, it will move to the general area and wait for a free space to open up.
A hauler spawns and moves to a specific source of energy (a resource pile, a container, a tombstone, etc.). The target may be in the same room or a different room. It withdraws the energy and then moves to one of many storage structures to deposit the energy. Sometimes, it is following a well-defined path or moving towards a frequent target (e.g. storage); sometimes, it is moving to a less frequent target (a specific extension).
A hauler moves from a source of energy (a resource pile, container, or storage) to a builder that needs energy. The builder’s location may change: it may be keeping position around a construction site, or traveling to the construction site.
A builder moves from a source of energy (a resource pile, container, or storage) to the closest of a set of active construction sites, usually not following a well-defined path.