Changeset 9498


Ignore:
Timestamp:
Dec 17, 2014 6:44:25 PM (4 years ago)
Author:
dlwoodr
Message:

Hacked up the start.in writer and need to check in to avoid confusion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyomo/trunk/pyomo/pysp/plugins/ddextension.py

    r9497 r9498  
    177177                          AllConstraintNames)
    178178
    179         #self.write_start_in(ph)
    180179        self.write_input2sip(ph)
    181180
     
    197196    def post_ph_execution(self, ph):
    198197        self.write_start_weights(ph)
     198        # self.write_start_in(ph)
    199199
    200200    # Write the lp file for a scenario and return the maximum
     
    765765    def write_start_in(self, ph):
    766766        first_stage_map = {}
     767        filename = "ph.csv"
     768        print ("will open ph.csv... hack...\n")
    767769        try:
    768             f = csv.reader(open("efCSVsolutionwriter_SSLP.csv", "rb"))
     770            f = csv.reader(open("ph.csv", "rb"))
    769771        except csv.Error:
    770772            e = sys.exc_info()[1]
    771             print(filename+" is not found!")
     773            print(filename+" cannot be opened!")
    772774            sys.exit('file %s, line %d: %s' % (filename, f.line_num, e))
    773775
     
    776778                row[n] = row[n].strip()
    777779
    778             if row[0]=='FirstStage': #note down x variable
    779                 if row[3] != 'None': #exclude 'hidden variables'
    780                     first_stage_map[row[3]] = row[4]
     780            # hideous hack
     781            if row[0]=='Stage_One': #note down x variable
     782                if row[2] != 'StageCost':
     783                    first_stage_map[row[2]+','+row[3]] = row[4]
    781784
    782785        try:
     
    787790            sys.exit(1)
    788791
    789         # keep track of input file names
    790         self.input_file_name_list.append('start.in')
     792        # keep track of input file names -- or not (dlw Dec 2014)
     793        ### self.input_file_name_list.append('start.in')
    791794
    792795        start.write("SOLUTION\n")
     
    796799            index[i] = str(index[i])
    797800        index.sort()
     801        print ("here are the indexes for the solution file:")
    798802        for ID in index:
     803            print (ID)
    799804            start.write(str(first_stage_map[ID])+"\n")
    800805
Note: See TracChangeset for help on using the changeset viewer.