示例#1
0
 def process(self, node):
     self.vars = []
     for child in node.childNodes:
         if child.nodeType == node.ELEMENT_NODE:
             child_text = get_xml_text(child)
             if child_text == "":  #pragma:nocover
                 continue
             if child.nodeName == "Real":
                 for val in re.split('[\t ]+', child_text):
                     self.vars.append(1.0 * eval(val))
     return self
示例#2
0
文件: point.py 项目: Pyomo/pyomo
 def process(self,node):
     self.vars = []
     for child in node.childNodes:
         if child.nodeType == node.ELEMENT_NODE:
             child_text = get_xml_text(child)
             if child_text == "":                #pragma:nocover
                 continue
             if child.nodeName == "Real":
                 for val in re.split('[\t ]+',child_text):
                     self.vars.append(1.0*eval(val))
     return self
示例#3
0
 def process(self, node):
     self.reals = []
     self.ints = []
     self.bits = []
     for child in node.childNodes:
         if child.nodeType == node.ELEMENT_NODE:
             child_text = get_xml_text(child)
             child_text.strip()
             if child_text == "":
                 continue
             if child.nodeName == "Real":
                 for val in re.split('[\t ]+', child_text):
                     self.reals.append(1.0 * eval(val))
             elif child.nodeName == "Integer":
                 for val in re.split('[\t ]+', child_text):
                     self.ints.append(eval(val))
             elif child.nodeName == "Binary":
                 tmp = child_text.replace(' ', '')
                 for val in tmp:
                     if val == '1':
                         self.bits.append(1)
                     elif val == '0':
                         self.bits.append(0)
     return self
示例#4
0
文件: point.py 项目: Pyomo/pyomo
 def process(self,node):
     self.reals=[]
     self.ints=[]
     self.bits=[]
     for child in node.childNodes:
         if child.nodeType == node.ELEMENT_NODE:
             child_text = get_xml_text(child)
             child_text.strip()
             if child_text == "":
                 continue
             if child.nodeName == "Real":
                 for val in re.split('[\t ]+',child_text):
                     self.reals.append(1.0*eval(val))
             elif child.nodeName == "Integer":
                 for val in re.split('[\t ]+',child_text):
                     self.ints.append(eval(val))
             elif child.nodeName == "Binary":
                 tmp = child_text.replace(' ', '')
                 for val in tmp:
                     if val == '1':
                         self.bits.append(1)
                     elif val == '0':
                         self.bits.append(0)
     return self