当前位置: 首页>>代码示例>>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;未经允许,请勿转载。