Esempio n. 1
0
 def convert(self, cmd, type, **kwds):
     args=re.split('[ ]+',cmd)
     args.append("--symbolic-solver-labels") # for readability / quick inspections
     if 'file' in kwds:
         OUTPUT=kwds['file']
     else:
         OUTPUT=StringIO()
     setup_redirect(OUTPUT)
     os.chdir(currdir)
     if type == 'lp':
         output = main.pyomo2lp(list(args))
     else:
         output = main.pyomo2nl(list(args))
     reset_redirect()
     if not 'file' in kwds:
         return OUTPUT.getvalue()
     return output.retval, output.errorcode
Esempio n. 2
0
 def convert(self, cmd, type, **kwds):
     args = re.split('[ ]+', cmd)
     args.append(
         "--symbolic-solver-labels")  # for readability / quick inspections
     if 'file' in kwds:
         OUTPUT = kwds['file']
     else:
         OUTPUT = StringIO()
     with capture_output(OUTPUT):
         os.chdir(currdir)
         if type == 'lp':
             output = main.pyomo2lp(list(args))
         else:
             output = main.pyomo2nl(list(args))
     if not 'file' in kwds:
         return OUTPUT.getvalue()
     return output.retval, output.errorcode
Esempio n. 3
0
 def run_convert2nl(self, name):
     os.chdir(currdir)
     return convert.pyomo2nl(['--symbolic-solver-labels'
                              ,join(scriptdir,name)])
Esempio n. 4
0
 def run_convert2nl(self, name):
     os.chdir(currdir)
     return convert.pyomo2nl(['--symbolic-solver-labels'
                              ,join(scriptdir,name)])