def parse_opbdp(variables, optimization, stdout):

    if re.search(r"^Constraint Set is unsatisfiable\r?$", stdout, re.M):
        return ("UNSATISFIABLE", None)
    elif re.search(r"^Global Minimum: ****** -?[0-9]+ ******\r?$", stdout, re.M):
        solution_match = re.search(r"^0-1 Variables fixed to 1 :([x0-9 ]*)\r?$", stdout, re.M)

        if solution_match:
            solution = numpy.zeros(variables, bool)
            (solution_chunk,) = answer_match.groups()

            for part in solution_chunk.split():
                solution[int(part[1:]) - 1] = True

            return (
                "OPTIMUM FOUND" if optimization else "SATISFIABLE",
                [("" if t else "-") + ("x%i" % (v + 1)) for (v, t) in enumerate(solution)],
                )

    return None
create or mark as read
dataset/ETHPy150Open borg-project/borg/borg/domains/pb/solvers.py/parse_opbdp--crossover with--dataset/ETHPy150Open nitely/Spirit/spirit/topic/unread/tests.py/TopicUnreadModelsTest.test_topic_unread_create_or_mark_as_read