Changeset 3100 for coopr.pysp/trunk/coopr/pysp/ef_writer_script.py
- Timestamp:
- Oct 14, 2010 4:54:49 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
coopr.pysp/trunk/coopr/pysp/ef_writer_script.py
r3089 r3100 107 107 dest="mipgap", 108 108 type="float", 109 default=None) 109 default=None) 110 110 parser.add_option("--solution-writer", 111 111 help="The plugin invoked to write the scenario tree solution. Defaults to the empty list.", … … 123 123 action="store_true", 124 124 dest="keep_solver_files", 125 default=False) 125 default=False) 126 126 parser.add_option("--profile", 127 127 help="Enable profiling of Python code. The value of this option is the number of functions that are summarized.", … … 138 138 action="store_true", 139 139 dest="traceback", 140 default=False) 140 default=False) 141 141 parser.usage=usage_string 142 142 143 143 return parser 144 144 145 145 def run_ef_writer(options, args): 146 146 … … 170 170 171 171 if (scenario_tree is None) or (binding_instance is None) or (scenario_instances is None): 172 raise RuntimeError, "Failed to write extensive form." 172 raise RuntimeError, "Failed to write extensive form." 173 173 174 174 if options.solve_ef is True: … … 178 178 raise ValueError, "Failed to create solver of type="+options.solver_type+" for use in extensive form solve" 179 179 if len(options.solver_options) > 0: 180 print "Initializing ef solver with options="+str(options.solver_options) 180 print "Initializing ef solver with options="+str(options.solver_options) 181 181 ef_solver.set_options("".join(options.solver_options)) 182 182 if options.mipgap is not None: … … 186 186 ef_solver.mipgap = options.mipgap 187 187 if options.keep_solver_files is True: 188 ef_solver.keepFiles = True 188 ef_solver.keepFiles = True 189 189 190 190 ef_solver_manager = SolverManagerFactory(options.solver_manager_type) … … 266 266 # Call the main EF writer without profiling. 267 267 # 268 if options.traceback is True: 268 if options.traceback is True: 269 269 ans = run_ef_writer(options, args) 270 270 else: 271 271 try: 272 ans = run_ef_writer(options, args) 272 ans = run_ef_writer(options, args) 273 273 except ValueError, str: 274 274 print "VALUE ERROR:" … … 279 279 except NameError, str: 280 280 print "NAME ERROR:" 281 print str 281 print str 282 282 except IOError, str: 283 283 print "IO ERROR:" … … 287 287 print str 288 288 except RuntimeError, str: 289 print "RUN-TIME ERROR:" 290 print str 289 print "RUN-TIME ERROR:" 290 print str 291 291 except: 292 292 print "Encountered unhandled exception" 293 293 traceback.print_exc() 294 sys.exit(0) 294 sys.exit(0) 295 295 296 296 gc.enable() 297 297 298 298 return ans 299 299
Note: See TracChangeset
for help on using the changeset viewer.