Ignore:
Timestamp:
Nov 29, 2010 5:26:46 PM (10 years ago)
Author:
jwatson
Message:

Adding two options to the runef and runph pysp scripts, to facilitate scenario downsampling - the case where you have a big tree, but you don't want to use it all.

The options are:
--scenario-tree-downsample-fraction=X
--scenario-tree-random-seed

The options are fairly self-explanatory - the only possible nuance is that the downsample fraction is the fraction of scenarios retained.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pysp/trunk/coopr/pysp/ef_writer_script.py

    r3155 r3261  
    4141   parser.usage=usage_string
    4242
    43    inputOpts  = OptionGroup( parser, 'Input Options' )
    44    efOpts     = OptionGroup( parser, 'EF Options' )
    45    solverOpts = OptionGroup( parser, 'Solver Options' )
    46    outputOpts = OptionGroup( parser, 'Output Options' )
    47    otherOpts  = OptionGroup( parser, 'Other Options' )
     43   inputOpts        = OptionGroup( parser, 'Input Options' )
     44   scenarioTreeOpts = OptionGroup( parser, 'Scenario Tree Options' )   
     45   efOpts           = OptionGroup( parser, 'EF Options' )
     46   solverOpts       = OptionGroup( parser, 'Solver Options' )
     47   outputOpts       = OptionGroup( parser, 'Output Options' )
     48   otherOpts        = OptionGroup( parser, 'Other Options' )
    4849   parser.add_option_group( inputOpts )
     50   parser.add_option_group( scenarioTreeOpts )
    4951   parser.add_option_group( efOpts )
    5052   parser.add_option_group( solverOpts )
     
    6466     type='string',
    6567     default='.')
     68
     69   scenarioTreeOpts.add_option('--scenario-tree-seed',
     70     help="The random seed associated with manipulation operations on the scenario tree (e.g., down-sampling). Default is 0, indicating unassigned.",
     71     action="store",
     72     dest="scenario_tree_random_seed",
     73     type="int",
     74     default=None)
     75   scenarioTreeOpts.add_option('--scenario-tree-downsample-fraction',
     76     help="The proportion of the scenarios in the scenario tree that are actually used. Specific scenarios are selected at random. Default is 1.0, indicating no down-sampling.",
     77     action="store",
     78     dest="scenario_tree_downsample_fraction",
     79     type="float",
     80     default=1.0)   
    6681
    6782   efOpts.add_option('--cvar-weight',
     
    192207                                                                               options.verbose,
    193208                                                                               options.linearize_expressions,
     209                                                                               options.scenario_tree_downsample_fraction,
     210                                                                               options.scenario_tree_random_seed,
    194211                                                                               generate_weighted_cvar, cvar_weight, risk_alpha)
    195212
Note: See TracChangeset for help on using the changeset viewer.