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


Python Interface.prepareboxes方法代码示例

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


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

示例1: ReadBifurcation

# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import prepareboxes [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)
开发者ID:E-LLP,项目名称:Kodiak,代码行数:40,代码来源:server.py


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