(idx, solver, logic, options, formula, signaling_queue, ctrl_pipe)
Function used by the child Process to handle Portfolio requests.

    solver  : name of the solver
    options : options for the solver
    formula : formula to assert
    signaling_queue: queue in which to write to indicate completion of solve
    ctrl_pipe: Pipe to communicate with parent process *after* solve
Function used by the child Process to handle Portfolio requests.
Function used by the child Process to handle Portfolio requests .
def _run_solver(idx, solver, logic, options, formula, signaling_queue, ctrl_pipe):
    """Function used by the child Process to handle Portfolio requests.

    solver  : name of the solver
    options : options for the solver
    formula : formula to assert
    signaling_queue: queue in which to write to indicate completion of solve
    ctrl_pipe: Pipe to communicate with parent process *after* solve
    """
    from pysmt.environment import get_env

    Solver = get_env().factory.Solver
    with Solver(name=solver, logic=logic, **options) as s:
        s.add_assertion(formula)
        try:
            local_res = s.solve()
        except Exception as ex:
            signaling_queue.put((solver, ex))
            return

        signaling_queue.put((idx, local_res))
        _exit = False
        while not _exit:
            try:
                cmd = ctrl_pipe.recv()
            except EOFError:
                break
            if type(cmd) == tuple:
                cmd, args = cmd
            if cmd == "exit":
                _exit = True
            elif cmd == "get_model":
                # MG: Can we pickle the EagerModel directly?
                # Note: contextualization happens on the receiver side
                model = list(s.get_model())
                ctrl_pipe.send(model)
            elif cmd == "get_value":
                args = get_env().formula_manager.normalize(args)
                ctrl_pipe.send(s.get_value(args))
            else:
                raise ValueError("Unknown command '%s'" % cmd)
def _run_solver ( idx , solver , logic , options , formula , signaling_queue , ctrl_pipe ) : from pysmt . environment import get_env Solver = get_env ( ) . factory . Solver with Solver ( name = solver , logic = logic , * * options ) as s : s . add_assertion ( formula ) try : local_res = s . solve ( ) except Exception as ex : signaling_queue . put ( ( solver , ex ) ) return signaling_queue . put ( ( idx , local_res ) ) _exit = False while not _exit : try : cmd = ctrl_pipe . recv ( ) except EOFError : break if type ( cmd ) == tuple : cmd , args = cmd if cmd == "exit" : _exit = True elif cmd == "get_model" : # MG: Can we pickle the EagerModel directly? # Note: contextualization happens on the receiver side model = list ( s . get_model ( ) ) ctrl_pipe . send ( model ) elif cmd == "get_value" : args = get_env ( ) . formula_manager . normalize ( args ) ctrl_pipe . send ( s . get_value ( args ) ) else : raise ValueError ( "Unknown command '%s'" % cmd )