當前位置: 首頁>>代碼示例>>Python>>正文


Python z3.Bool方法代碼示例

本文整理匯總了Python中z3.Bool方法的典型用法代碼示例。如果您正苦於以下問題:Python z3.Bool方法的具體用法?Python z3.Bool怎麽用?Python z3.Bool使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在z3的用法示例。


在下文中一共展示了z3.Bool方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import Bool [as 別名]
def __init__(
        self,
        ast: mlil_ast.MediumLevelILAst,
        condition: Bool,
        condition_il: MediumLevelILInstruction,
        true: MediumLevelILAstNode,
        false: MediumLevelILAstNode = None,
    ):
        if condition is None:
            raise NotImplementedError("condition should not be None")
        self._condition = condition
        super().__init__(ast)
        self._type = "cond"
        self._condition_il = condition_il
        self._true = true
        self._false = false

        self._flatten_conditions() 
開發者ID:joshwatson,項目名稱:f-ing-around-with-binaryninja,代碼行數:20,代碼來源:nodes.py

示例2: _gen_variable

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import Bool [as 別名]
def _gen_variable(self, qb_id):
        """ After each gate generate a new unique variable name for each of the
            qubits, using scheme: 'q[id]_[gatenum]', e.g. q1_0 -> q1_1 -> q1_2,
                                                          q2_0 -> q2_1
        Args:
            qb_id (int): index of qubit to generate new variable for
        Returns:
            BoolRef: z3 variable of qubit state
        """
        varname = "q" + str(qb_id) + "_" + str(self.gatenum[qb_id])
        var = Bool(varname)
        self.gatenum[qb_id] += 1
        self.variables[qb_id].append(var)
        return var 
開發者ID:Qiskit,項目名稱:qiskit-terra,代碼行數:16,代碼來源:hoare_opt.py

示例3: create_z3_vars

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import Bool [as 別名]
def create_z3_vars(self):
        """
        Setup the variables required for Z3 optimization
        """
        for gate in self.dag.gate_nodes():
            t_var_name = 't_' + str(self.gate_id[gate])
            d_var_name = 'd_' + str(self.gate_id[gate])
            f_var_name = 'f_' + str(self.gate_id[gate])
            self.gate_start_time[gate] = Real(t_var_name)
            self.gate_duration[gate] = Real(d_var_name)
            self.gate_fidelity[gate] = Real(f_var_name)
        for gate in self.xtalk_overlap_set:
            self.overlap_indicator[gate] = {}
            self.overlap_amounts[gate] = {}
        for g_1 in self.xtalk_overlap_set:
            for g_2 in self.xtalk_overlap_set[g_1]:
                if len(g_2.qargs) == 2 and g_1 in self.overlap_indicator[g_2]:
                    self.overlap_indicator[g_1][g_2] = self.overlap_indicator[g_2][g_1]
                    self.overlap_amounts[g_1][g_2] = self.overlap_amounts[g_2][g_1]
                else:
                    # Indicator variable for overlap of g_1 and g_2
                    var_name1 = 'olp_ind_' + str(self.gate_id[g_1]) + '_' + str(self.gate_id[g_2])
                    self.overlap_indicator[g_1][g_2] = Bool(var_name1)
                    var_name2 = 'olp_amnt_' + str(self.gate_id[g_1]) + '_' + str(self.gate_id[g_2])
                    self.overlap_amounts[g_1][g_2] = Real(var_name2)
        active_qubits_list = []
        for gate in self.dag.gate_nodes():
            for q in gate.qargs:
                active_qubits_list.append(q.index)
        for active_qubit in list(set(active_qubits_list)):
            q_var_name = 'l_' + str(active_qubit)
            self.qubit_lifetime[active_qubit] = Real(q_var_name)

        meas_q = []
        for node in self.dag.op_nodes():
            if isinstance(node.op, Measure):
                meas_q.append(node.qargs[0].index)

        self.measured_qubits = list(set(self.input_measured_qubits).union(set(meas_q)))
        self.measure_start = Real('meas_start') 
開發者ID:Qiskit,項目名稱:qiskit-terra,代碼行數:42,代碼來源:crosstalk_adaptive_schedule.py

示例4: __init__

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import Bool [as 別名]
def __init__(self, name):
        self.name = name
        self.__z3__ = z3.Bool(self.name)


# TODO write test that these areq unique with pointer eq
# i.e StatVar('x') != StatVar('x')
# vs
# x = StatVar('x')
# assert x == x 
開發者ID:emjun,項目名稱:tea-lang,代碼行數:12,代碼來源:solver.py

示例5: condition

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import Bool [as 別名]
def condition(self) -> Bool:
        return self._condition 
開發者ID:joshwatson,項目名稱:f-ing-around-with-binaryninja,代碼行數:4,代碼來源:nodes.py

示例6: z3Node

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import Bool [as 別名]
def z3Node(self):
	return z3.Bool(self.name) 
開發者ID:jeanqasaur,項目名稱:jeeves,代碼行數:4,代碼來源:AST.py

示例7: getBoolVar

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import Bool [as 別名]
def getBoolVar(self, name):
    return z3.Bool(name) 
開發者ID:jeanqasaur,項目名稱:jeeves,代碼行數:4,代碼來源:Z3.py


注:本文中的z3.Bool方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。