[BUG] correct cost computation (include 'self-edge-intersection' of chain