Changeset 3264


Ignore:
Timestamp:
Dec 1, 2010 1:16:01 PM (10 years ago)
Author:
jwatson
Message:

Adding PySP extensive form tests.

Location:
coopr.pysp/trunk/coopr/pysp/tests/unit
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pysp/trunk/coopr/pysp/tests/unit/test_ph.py

    r2931 r3264  
    2424import coopr.plugins.mip
    2525import coopr.pysp.phinit
     26import coopr.pysp.ef_writer_script
    2627
    2728def filter_time(line):
     
    127128        self.cleanup()       
    128129
     130    def test_farmer_ef(self):
     131        pyutilib.misc.setup_redirect(current_directory+"farmer_ef.out")
     132        farmer_examples_dir = pysp_examples_dir + "farmer"
     133        model_dir = farmer_examples_dir + os.sep + "models"
     134        instance_dir = farmer_examples_dir + os.sep + "scenariodata"       
     135        argstring = "runef --verbose --output-file=farmer_ef.out --model-directory="+model_dir+" --instance-directory="+instance_dir
     136        args = string.split(argstring)
     137        coopr.pysp.ef_writer_script.run(args=args)       
     138        pyutilib.misc.reset_redirect()
     139        self.cleanup()               
     140        self.failUnlessFileEqualsBaseline(current_directory+"farmer_ef.out",current_directory+"farmer_ef.baseline", filter=filter_time)
     141
     142    def test_farmer_ef_cvar(self):
     143        pyutilib.misc.setup_redirect(current_directory+"farmer_ef_cvar.out")
     144        farmer_examples_dir = pysp_examples_dir + "farmer"
     145        model_dir = farmer_examples_dir + os.sep + "models"
     146        instance_dir = farmer_examples_dir + os.sep + "scenariodata"       
     147        argstring = "runef --verbose --output-file=farmer_ef_cvar.out --generate-weighted-cvar --risk-alpha=0.90 --cvar-weight=0.0 --model-directory="+model_dir+" --instance-directory="+instance_dir
     148        args = string.split(argstring)
     149        coopr.pysp.ef_writer_script.run(args=args)       
     150        pyutilib.misc.reset_redirect()
     151        self.cleanup()               
     152        self.failUnlessFileEqualsBaseline(current_directory+"farmer_ef_cvar.out",current_directory+"farmer_ef_cvar.baseline", filter=filter_time)
     153
    129154TestPH = unittest.category('nightly')(TestPH)
    130155
Note: See TracChangeset for help on using the changeset viewer.