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


Python Common.evalForNum方法代码示例

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


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

示例1: ConstraintNotDominatedByX

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import evalForNum [as 别名]
 def ConstraintNotDominatedByX(self, model):
     """
     Creates a constraint preventing search in dominated regions.
     """
     DisjunctionOrLessMetrics = list()
     for i in range(len(self.metrics_variables)):
         if self.metrics_objective_direction[i] == Common.METRICS_MAXIMIZE:
             DisjunctionOrLessMetrics.append(
                 SMTLib.SMT_GT(
                     self.metrics_variables[i],
                     SMTLib.SMT_IntConst(
                         Common.evalForNum(model, self.metrics_variables[i].convert(self.cfr.solver.converter))
                     ),
                 )
             )  # model[self.metrics_variables[i]])
         else:
             DisjunctionOrLessMetrics.append(
                 SMTLib.SMT_LT(
                     self.metrics_variables[i],
                     SMTLib.SMT_IntConst(
                         Common.evalForNum(model, self.metrics_variables[i].convert(self.cfr.solver.converter))
                     ),
                 )
             )  # model[self.metrics_variables[i]])
     return SMTLib.SMT_Or(*DisjunctionOrLessMetrics)
开发者ID:srenatus,项目名称:ClaferSMT,代码行数:27,代码来源:npGIAforZ3.py

示例2: ConstraintMustDominatesX

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import evalForNum [as 别名]
 def ConstraintMustDominatesX(self, model):
     """
     Returns a constraint that a new instance has to be better than the instance represented by model in at least one dimension, 
     and better or equal in all the other ones.
     """
     dominationDisjunction = []
     i = 0
     for dominatedByMetric in self.metrics_variables:
         dominationConjunction = []
         j = 0
         if self.metrics_objective_direction[i] == Common.METRICS_MAXIMIZE:
             dominationConjunction.append(
                 SMTLib.SMT_GT(
                     dominatedByMetric,
                     SMTLib.SMT_IntConst(
                         Common.evalForNum(model, dominatedByMetric.convert(self.cfr.solver.converter))
                     ),
                 )
             )
         else:
             dominationConjunction.append(
                 SMTLib.SMT_LT(
                     dominatedByMetric,
                     SMTLib.SMT_IntConst(
                         Common.evalForNum(model, dominatedByMetric.convert(self.cfr.solver.converter))
                     ),
                 )
             )
         for AtLeastEqualInOtherMetric in self.metrics_variables:
             if j != i:
                 if self.metrics_objective_direction[j] == Common.METRICS_MAXIMIZE:
                     dominationConjunction.append(
                         SMTLib.SMT_GE(
                             AtLeastEqualInOtherMetric,
                             SMTLib.SMT_IntConst(
                                 Common.evalForNum(
                                     model, AtLeastEqualInOtherMetric.convert(self.cfr.solver.converter)
                                 )
                             ),
                         )
                     )
                 else:
                     dominationConjunction.append(
                         SMTLib.SMT_LE(
                             AtLeastEqualInOtherMetric,
                             SMTLib.SMT_IntConst(
                                 Common.evalForNum(
                                     model, AtLeastEqualInOtherMetric.convert(self.cfr.solver.converter)
                                 )
                             ),
                         )
                     )
             j = 1 + j
         i = 1 + i
         dominationDisjunction.append(SMTLib.SMT_And(*dominationConjunction))
     constraintDominateX = SMTLib.SMT_Or(*dominationDisjunction)
     return constraintDominateX
开发者ID:srenatus,项目名称:ClaferSMT,代码行数:59,代码来源:npGIAforZ3.py

示例3: ConstraintEqualToX

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import evalForNum [as 别名]
 def ConstraintEqualToX(self, model):
     """
     Returns a Constraint that a  new instance, can't be dominated by the instance represented by model. 
     (it can't be worst in any objective).
     """
     EqualMetrics = list()
     for i in range(len(self.metrics_variables)):
         EqualMetrics.append(
             SMTLib.SMT_EQ(self.metrics_variables[i], Common.evalForNum(model, self.metrics_variables[i]))
         )
     return SMTLib.SMT_And(EqualMetrics)
开发者ID:srenatus,项目名称:ClaferSMT,代码行数:13,代码来源:npGIAforZ3.py


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