本文整理汇总了Python中openmdao.main.expreval.ExprEvaluator._invalid_expression_error方法的典型用法代码示例。如果您正苦于以下问题:Python ExprEvaluator._invalid_expression_error方法的具体用法?Python ExprEvaluator._invalid_expression_error怎么用?Python ExprEvaluator._invalid_expression_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openmdao.main.expreval.ExprEvaluator
的用法示例。
在下文中一共展示了ExprEvaluator._invalid_expression_error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from openmdao.main.expreval import ExprEvaluator [as 别名]
# 或者: from openmdao.main.expreval.ExprEvaluator import _invalid_expression_error [as 别名]
def __init__(self, lhs, comparator, rhs, scope, jacs=None):
self.lhs = ExprEvaluator(lhs, scope=scope)
self._pseudo = None
self.pcomp_name = None
unresolved_vars = self.lhs.get_unresolved()
if unresolved_vars:
msg = "Left hand side of constraint '{0}' has invalid variables {1}"
expression = ' '.join((lhs, comparator, rhs))
raise ExprEvaluator._invalid_expression_error(unresolved_vars,
expr=expression,
msg=msg)
self.rhs = ExprEvaluator(rhs, scope=scope)
unresolved_vars = self.rhs.get_unresolved()
if unresolved_vars:
msg = "Right hand side of constraint '{0}' has invalid variables {1}"
expression = ' '.join((lhs, comparator, rhs))
raise ExprEvaluator._invalid_expression_error(unresolved_vars,
expr=expression,
msg=msg)
self.comparator = comparator
self._size = None
# Linear flag: constraints are nonlinear by default
self.linear = False
# User-defined jacobian function
self.jacs = jacs
self._create_pseudo()
示例2: __init__
# 需要导入模块: from openmdao.main.expreval import ExprEvaluator [as 别名]
# 或者: from openmdao.main.expreval.ExprEvaluator import _invalid_expression_error [as 别名]
def __init__(self, lhs, comparator, rhs, scope):
self.lhs = ExprEvaluator(lhs, scope=scope)
unresolved_vars = self.lhs.get_unresolved()
if unresolved_vars:
msg = "Left hand side of constraint '{0}' has invalid variables {1}"
expression = ' '.join([lhs, comparator, rhs])
raise ExprEvaluator._invalid_expression_error(unresolved_vars, expr=expression, msg=msg)
self.rhs = ExprEvaluator(rhs, scope=scope)
unresolved_vars = self.rhs.get_unresolved()
if unresolved_vars:
msg = "Right hand side of constraint '{0}' has invalid variables {1}"
expression = ' '.join([lhs, comparator, rhs])
raise ExprEvaluator._invalid_expression_error(unresolved_vars, expr=expression, msg=msg)
self.comparator = comparator
self.pcomp_name = None
self._size = None