当前位置: 首页>>代码示例>>Python>>正文


Python Common.aggregate_polarity方法代码示例

本文整理汇总了Python中common.Common.aggregate_polarity方法的典型用法代码示例。如果您正苦于以下问题:Python Common.aggregate_polarity方法的具体用法?Python Common.aggregate_polarity怎么用?Python Common.aggregate_polarity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.Common的用法示例。


在下文中一共展示了Common.aggregate_polarity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: op_intersection

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import aggregate_polarity [as 别名]
def op_intersection(left,right):
    '''
    :param left:
    :type left: :class:`~ExprArg`
    :param right:
    :type right: :class:`~ExprArg`
    :returns: :class:`~ExprArg` 
    
    Computes the set intersection (left & right)
    '''
    assert isinstance(left, ExprArg)
    assert isinstance(right, ExprArg)
    if left.getInts() or right.getInts():
        sys.exit("FIXME ints intersection")
    matches = getSetInstancePairs(left,right)
    newInstances = {}
    for (sort,index) in matches.keys():
        key = (sort,index)
        ((lexpr,lpol),(rexpr,rpol)) = matches[(sort,index)]
        if rpol == Common.DEFINITELY_OFF or lpol == Common.DEFINITELY_OFF:
            continue
        else:
            new_expr = mAnd(lexpr,rexpr)
            newInstances[key] = (new_expr, Common.aggregate_polarity(lpol, rpol))
    return ExprArg(newInstances)
开发者ID:gsdlab,项目名称:ClaferSMT,代码行数:27,代码来源:Set.py

示例2: addMatchValues

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import aggregate_polarity [as 别名]
def addMatchValues(matches, instances, left=True):
    '''
    Ignores PrimitiveSorts
    '''
    for (sort, index) in instances.keys():
        (expr,polarity) = instances[(sort,index)]
        #!!!
        default = (SMTLib.SMT_BoolConst(False), Common.DEFINITELY_OFF)
        (prev_left, prev_right) = matches.get((sort,index), (default,default))
        if left:
            (prev_expr, prev_pol) = prev_left
            new_left = (mOr(expr, prev_expr), Common.aggregate_polarity(polarity, prev_pol))
            new_right = prev_right
        else:
            (prev_expr, prev_pol) = prev_right
            new_left = prev_left
            new_right = (mOr(expr, prev_expr), Common.aggregate_polarity(polarity, prev_pol))
        matches[(sort,index)] = (new_left,new_right)

    return matches
开发者ID:gsdlab,项目名称:ClaferSMT,代码行数:22,代码来源:Set.py

示例3: getInstances

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import aggregate_polarity [as 别名]
 def getInstances(self, nonsupered=False):
     if nonsupered or self.hasBeenSupered:
         return self.clafers
     else:
         newClafers = {}
         for (sort, index) in self.clafers.keys():
             (expr, polarity) = self.clafers[(sort,index)]
             if polarity == Common.DEFINITELY_OFF:
                 continue
             key = (sort.highestSuperSort, sort.indexInHighestSuper + index)
             if polarity == Common.DEFINITELY_ON:
                 newClafers[key] = (SMTLib.SMT_BoolConst(True), Common.DEFINITELY_ON)
                 continue
             (currEntry, currPolarity) = newClafers.get(key, (SMTLib.SMT_BoolConst(False), Common.DEFINITELY_OFF))
             currEntry = mOr(currEntry, expr)
             newClafers[key] = (currEntry, Common.aggregate_polarity(currPolarity, polarity))
         self.clafers = newClafers
         self.hasBeenSupered = True 
     return self.clafers
开发者ID:gsdlab,项目名称:ClaferSMT,代码行数:21,代码来源:ExprArg.py


注:本文中的common.Common.aggregate_polarity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。