Ignore:
Timestamp:
Dec 11, 2009 12:23:17 AM (11 years ago)
Author:
jwatson
Message:

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.

File:
1 edited

Legend:

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

    r1768 r1979  
    4040                  type="string",
    4141                  default=".")
     42parser.add_option("--generate-weighted-cvar",
     43                  help="Add a weighted CVaR term to the primary objective",
     44                  action="store_true",
     45                  dest="generate_weighted_cvar",
     46                  default=False)
     47parser.add_option("--cvar-weight",
     48                  help="The weight associated with the CVaR term in the risk-weighted objective formulation.",
     49                  action="store",
     50                  dest="cvar_weight",
     51                  type="float",
     52                  default=1.0)
     53parser.add_option("--risk-alpha",
     54                  help="The probability threshold associated with cvar (or any future) risk-oriented performance metrics.",
     55                  action="store",
     56                  dest="risk_alpha",
     57                  type="float",
     58                  default=0.95)
    4259parser.add_option("--output-file",
    4360                  help="Specify the name of the extensive form output file",
     
    5572def run_ef_writer(options, args):
    5673
    57    write_ef_from_scratch(options.model_directory, options.instance_directory, options.output_file)
     74   # if the user enabled the addition of the weighted cvar term to the objective,
     75   # then validate the associated parameters.
     76   generate_weighted_cvar = False
     77   cvar_weight = None
     78   risk_alpha = None
     79
     80   if options.generate_weighted_cvar is True:
     81
     82      generate_weighted_cvar = True
     83      cvar_weight = options.cvar_weight
     84      risk_alpha = options.risk_alpha
     85
     86   write_ef_from_scratch(options.model_directory, options.instance_directory, options.output_file, \
     87                         generate_weighted_cvar, cvar_weight, risk_alpha)
    5888
    5989   return
Note: See TracChangeset for help on using the changeset viewer.