def flip_all(self, tour):
        """ Initialize the orientations based on pairwise O matrix.
        """
        if self.signs is None:  # First run
            score = 0
        else:
            old_signs = self.signs[:self.N]
            score, = self.evaluate_tour_Q(tour)

        # Remember we cannot have ambiguous orientation code (0 or '?') here
        self.signs = get_signs(self.O, validate=False, ambiguous=False)
        score_flipped, = self.evaluate_tour_Q(tour)
        if score_flipped >= score:
            tag = ACCEPT
        else:
            self.signs = old_signs[:]
            tag = REJECT
        self.flip_log("FLIPALL", score, score_flipped, tag)
        return tag
Initialize the orientations based on pairwise O matrix.