本文整理汇总了Python中interface.Interface.var_exp方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.var_exp方法的具体用法?Python Interface.var_exp怎么用?Python Interface.var_exp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.Interface
的用法示例。
在下文中一共展示了Interface.var_exp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ReadBifurcation
# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import var_exp [as 别名]
def ReadBifurcation(bifurcations):
'''Reads the bifurcation message stored in bifurcations.
Args:
bifurcations: A bifurcations list containing bifurcation from kodiakmessages.proto.
Returns:
A tuple containing Boolean and a list.
(True, List) if there was a bifurcation written the file.
(False, ()) if not.
'''
# If no bifurcation problems written to file return.
if(len(bifurcations) is None):
return (False,())
interface = Interface()
parser = kodiak_parser.KodiakParser(interface = interface)
parser.parse("set safe input = false")
for bifurcation in bifurcations:
for var in bifurcation.var:
# Passes variables from shared file to kodiak
interface.var_exp(var.name.encode("UTF-8"),('INTERVAL', ("approx",var.lb), ("approx",var.ub)))
for param in bifurcation.param:
# Passes params from shared file to kodiak
interface.var_exp(param.name.encode("UTF-8"),('INTERVAL', ("approx",param.lb ), ("approx",param.ub)), False)
for dfeq in bifurcation.dfeq:
# Passes csntrs from shared file to parser which then sends it to kodiak
parser.parse("dfeq "+dfeq.dfeq.encode("UTF-8"))
for cnstr in bifurcation.cnstr:
# Passes csntrs from shared file to parser which then sends it to kodiak
parser.parse("cnstr "+cnstr.cnstr.encode("UTF-8"))
# Tells kodiak to solve a bifurcation problem.
interface.bifurcation()
# Extracts the answer from kodiak into boxes prepared for writing to file
boxes = interface.prepareboxes()
interface.reset_env()
return (True, boxes)