Changeset 2213


Ignore:
Timestamp:
Jan 31, 2010 1:03:26 AM (9 years ago)
Author:
wehart
Message:

Adding the ability to process multiple *.dat files on the Pyomo command line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/scripting/util.py

    r2170 r2213  
    162162    # Create Problem Instance
    163163    #
    164     if len(args) == 2:
     164    if len(args) > 2:
     165        #
     166        # Load a list of *.dat files
     167        #
     168        modeldata = ModelData()
     169        for file in args[1:]:
     170            suffix = (file).split(".")[-1]
     171            if suffix != "dat":
     172                raise SystemExit, "When specifying multiple data files, they must all be *.dat files: "+str(file)
     173            modeldata.add_data_file(file)
     174        modeldata.read(model)
     175        instance = model.create(modeldata)
     176         
     177    elif len(args) == 2:
     178       #
     179       # Load a *.dat file or process a *.py data file
     180       #
    165181       suffix = (args[1]).split(".")[-1]
    166182       if suffix == "dat":
Note: See TracChangeset for help on using the changeset viewer.