source: coopr.pysp/stable/2.1/scripts/efwriter @ 2068

Last change on this file since 2068 was 2068, checked in by wehart, 10 years ago

Merged revisions 1952-2067 via svnmerge from
https://software.sandia.gov/svn/public/coopr/coopr.pysp/trunk

........

r1956 | jwatson | 2009-12-02 17:56:53 -0700 (Wed, 02 Dec 2009) | 3 lines


Added --scenario-solver-options and --ef-solver-options options to the "runph" script.

........

r1957 | dlwoodr | 2009-12-03 14:17:35 -0700 (Thu, 03 Dec 2009) | 2 lines


Documentation updates for pysp

........

r1974 | wehart | 2009-12-06 17:20:56 -0700 (Sun, 06 Dec 2009) | 2 lines


Updating PyPI categories

........

r1978 | jwatson | 2009-12-10 21:29:33 -0700 (Thu, 10 Dec 2009) | 3 lines


Eliminated exception-handling logic when loading user-defined extension modules in PH. The range of exceptions is too large, and for debugging purposes, it is more useful to see the raw trace output.

........

r1979 | jwatson | 2009-12-10 22:23:17 -0700 (Thu, 10 Dec 2009) | 5 lines


Biggest enhancement: The efwriter command-line script now has the option to output a CVaR-weighted objective term. Not extensively tested, but behaves sane on a number of small test cases.


Improved exception handling and error diagnostics in both the runph and efwriter scripts.

........

r1985 | jwatson | 2009-12-12 10:45:17 -0700 (Sat, 12 Dec 2009) | 3 lines


Modified PH to only use warm-starts if a solver has the capability!

........

r1998 | jwatson | 2009-12-13 15:17:58 -0700 (Sun, 13 Dec 2009) | 3 lines


Changed references to _component to active_component.

........

r2026 | wehart | 2009-12-21 23:27:06 -0700 (Mon, 21 Dec 2009) | 2 lines


Attempting to update PH. I'm not sure if this works, since I don't know how to test PH.

........

r2029 | jwatson | 2009-12-22 09:52:21 -0700 (Tue, 22 Dec 2009) | 3 lines


Some fixes to the ef writer based on Bill's recent changes to _initialize_constraint.

........

r2035 | jwatson | 2009-12-22 21:10:32 -0700 (Tue, 22 Dec 2009) | 3 lines


Added --scenario-mipgap option to PH script. Added _mipgap attribute to PH object. This attribute is mirrored to the solver plugin at the initiation of each iteration, after any PH extensions have the opportunity to provide a new value to the attribute. It is currently made use of by the WW PH extension.

........

r2037 | dlwoodr | 2009-12-23 14:38:43 -0700 (Wed, 23 Dec 2009) | 2 lines


add this example from Fernando

........

r2038 | dlwoodr | 2009-12-23 14:46:56 -0700 (Wed, 23 Dec 2009) | 3 lines


finish the job: we can now duplicate Fernando's example

........

r2039 | jwatson | 2009-12-23 15:13:54 -0700 (Wed, 23 Dec 2009) | 3 lines


Missed fix with new constraint initialization syntax in PH linearization.

........

r2058 | jwatson | 2009-12-29 10:57:58 -0700 (Tue, 29 Dec 2009) | 3 lines


Missed some _initialize_constraint function calls within the PySP EF writer during the recent switch to the corresponding "add" method.

........

r2059 | jwatson | 2009-12-29 10:58:34 -0700 (Tue, 29 Dec 2009) | 3 lines


Enabling garbage collection by default in PH.

........

r2060 | jwatson | 2009-12-29 10:59:05 -0700 (Tue, 29 Dec 2009) | 3 lines


Elimnating some debug output.

........

r2061 | jwatson | 2009-12-29 11:07:47 -0700 (Tue, 29 Dec 2009) | 3 lines


Fixing some option documentation in PH.

........

r2062 | jwatson | 2009-12-29 12:00:37 -0700 (Tue, 29 Dec 2009) | 3 lines


Added ef-mipgap option to PH scripts.

........

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#! /usr/bin/env python
2#
3# A script that runs reads in a PySP stochastic programming instance and writes the extensive form.
4# Currently takes no arguments, and assumes the instance definition files are in the current directory.
5#  _________________________________________________________________________
6#
7#  Coopr: A COmmon Optimization Python Repository
8#  Copyright (c) 2009 Sandia Corporation.
9#  This software is distributed under the BSD License.
10#  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
11#  the U.S. Government retains certain rights in this software.
12#  For more information, see the FAST README.txt file.
13#  _________________________________________________________________________
14
15import traceback
16import sys
17if sys.version_info[0:2] < (2,4):
18   print ""
19   print "ERROR: Pyomo requires Python 2.4 or newer"
20   sys.exit(1)
21from os.path import abspath, dirname
22import os
23import pyutilib.common
24sys.path.insert(0, dirname(dirname(abspath(__file__))))
25sys.path.append(".")
26currdir = dirname(abspath(__file__))
27coopr_path = dirname(currdir)
28pyutilib_path = dirname(coopr_path)+os.sep+"pyutilib"
29sys.path.append(coopr_path)
30sys.path.append(pyutilib_path)
31sys.path.append(abspath(os.getcwd()))
32#
33# Adjust the user path if it looks like this script is being used
34# from an Acro build (adds the Acro bin directory, if it exists).
35#
36# Recurse up the current path, looking for a subdirectory that
37# contains 'python' and 'bin'
38#
39curr = os.path.abspath(os.getcwd())
40while os.sep in curr:
41    if os.path.exists(curr+os.sep+"python") and os.path.exists(curr+os.sep+"bin"):
42        os.environ["PATH"] = curr+os.sep+"bin:"+os.environ["PATH"]
43        break
44    if os.path.basename(curr) == "":
45        break
46    curr = os.path.dirname(curr)
47
48import coopr.pysp.ef_writer_script
49
50try:
51    coopr.pysp.ef_writer_script.run()
52except ValueError, str:
53    print "VALUE ERROR:"   
54    print str
55except IOError, str:
56    print "IO ERROR:"   
57    print str
58except RuntimeError, str:
59    print "RUN-TIME ERROR:"   
60    print str   
61except pyutilib.common.ApplicationError, str:
62    print "APPLICATION ERROR:"   
63    print str
64except:
65   print "Encountered unhandled exception"
66   traceback.print_exc()
Note: See TracBrowser for help on using the repository browser.