Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def pysp_compile_scenario_tree_register_options(options):
from pyomo.pysp.scenariotree.scenariotreemanager import \
(ScenarioTreeManagerSerial,
ScenarioTreeManagerSPPyro)
safe_register_common_option(options, "disable_gc")
safe_register_common_option(options, "profile")
safe_register_common_option(options, "traceback")
safe_register_common_option(options, "verbose")
safe_register_common_option(options, "output_times")
safe_register_unique_option(
options,
"output_directory",
ConfigValue(
".",
domain=_domain_must_be_str,
description=(
"The directory in which to store all output files. "
"Default is '.'."
),
doc=None,
visibility=0))
safe_register_unique_option(
options,
"compiled_reference_model_filename",
def pysp2smps_register_options(options=None):
if options is None:
options = PySPConfigBlock()
safe_register_common_option(options, "disable_gc")
safe_register_common_option(options, "profile")
safe_register_common_option(options, "traceback")
safe_register_common_option(options, "verbose")
safe_register_common_option(options, "symbolic_solver_labels")
safe_register_common_option(options, "file_determinism")
safe_register_unique_option(
options,
"explicit",
PySPConfigValue(
False,
domain=bool,
description=(
"Generate SMPS files using explicit scenarios "
"(or bundles). ** This option is deprecated. It is "
"the default behavior. ** "
),
doc=None,
visibility=0))
doc=None,
visibility=0))
safe_register_unique_option(
options,
"keep_auxiliary_files",
PySPConfigValue(
False,
domain=bool,
description=(
"Keep auxiliary files for the template scenario that are normally "
"used for testing the validity of the SMPS conversion. "
"These include the .row, .col, .sto.struct, and .[mps,lp].det files."
),
doc=None,
visibility=0))
safe_register_common_option(options, "scenario_tree_manager")
ScenarioTreeManagerClientSerial.register_options(options)
ScenarioTreeManagerClientPyro.register_options(options)
return options
doc=None,
visibility=0))
safe_register_unique_option(
options,
"keep_auxiliary_files",
PySPConfigValue(
False,
domain=bool,
description=(
"Keep auxiliary files for the template scenario that are normally "
"used for testing the validity of the SMPS conversion. "
"These include the .row, .col, .sto.struct, and .[mps,lp].det files."
),
doc=None,
visibility=0))
safe_register_common_option(options, "scenario_tree_manager")
ScenarioTreeManagerClientSerial.register_options(options)
ScenarioTreeManagerClientPyro.register_options(options)
return options
class ScenarioTreeManagerSPPyroBasic(_ScenarioTreeManagerImpl,
_ScenarioTreeManager,
PySPConfiguredObject):
_registered_options = \
PySPConfigBlock("Options registered for the "
"ScenarioTreeManagerSPPyroBasic class")
safe_register_common_option(_registered_options,
"pyro_host")
safe_register_common_option(_registered_options,
"pyro_port")
safe_register_common_option(_registered_options,
"shutdown_pyro")
safe_register_common_option(_registered_options,
"shutdown_sppyro_servers")
SPPyroScenarioTreeServer.register_options(_registered_options)
def __init__(self, *args, **kwds):
# distributed worker information
self._sppyro_server_workers_map = {}
self._sppyro_worker_server_map = {}
# the same as the .keys() of the above map
# but won't suffer from stochastic iteration
# order python dictionaries
self._sppyro_worker_list = []
self._action_manager = None
self._transmission_paused = False
super(ScenarioTreeManagerSPPyroBasic, self).__init__(*args, **kwds)
#
def scenariotreeserver_register_options(options=None):
if options is None:
options = PySPConfigBlock()
safe_register_common_option(options, "disable_gc")
safe_register_common_option(options, "profile")
safe_register_common_option(options, "traceback")
safe_register_common_option(options, "verbose")
safe_register_common_option(options, "pyro_host")
safe_register_common_option(options, "pyro_port")
safe_register_unique_option(
options,
"import_module",
PySPConfigValue(
(),
domain=_domain_tuple_of_str,
description=(
"The name of a user-defined python module to import that, "
"e.g., registers a user-defined scenario tree worker class."
),
doc=None,
visibility=0))
return options
def runddsip_register_options(options=None):
if options is None:
options = PySPConfigBlock()
DDSIPSolver.register_options(options)
ScenarioTreeManagerFactory.register_options(options)
safe_register_common_option(options,
"verbose")
safe_register_common_option(options,
"disable_gc")
safe_register_common_option(options,
"profile")
safe_register_common_option(options,
"traceback")
safe_register_common_option(options,
"output_scenario_tree_solution")
safe_register_common_option(options,
"keep_solver_files")
safe_register_common_option(options,
"output_solver_log")
safe_register_common_option(options,
"symbolic_solver_labels")
# used to populate the implicit DDSIP options
safe_register_unique_option(
options,
"solver_options",
PySPConfigValue(
(),
domain=_domain_tuple_of_str_or_dict,
description=(
"Unregistered solver options that will be passed "
"to DDSIP via the config file (e.g., NODELIM=4, "
"CPLEX_1067=1). This option can be used multiple "
def runadmm_register_options(options=None):
if options is None:
options = PySPConfigBlock()
ADMMSolver.register_options(options)
ScenarioTreeManagerFactory.register_options(options)
safe_register_common_option(options,
"verbose")
safe_register_common_option(options,
"disable_gc")
safe_register_common_option(options,
"profile")
safe_register_common_option(options,
"traceback")
safe_register_common_option(options,
"output_solver_log")
safe_register_common_option(options,
"output_scenario_tree_solution")
safe_register_unique_option(
options,
"default_rho",
PySPConfigValue(
1.0,
domain=_domain_positive,
description=(
"The default rho value for all non-anticipative "
"variables. Default is 1.0."
def convertsmps_register_options(options=None):
if options is None:
options = PySPConfigBlock()
safe_register_common_option(options, "disable_gc")
safe_register_common_option(options, "profile")
safe_register_common_option(options, "traceback")
safe_register_common_option(options, "verbose")
safe_register_common_option(options, "symbolic_solver_labels")
safe_register_unique_option(
options,
"explicit",
PySPConfigValue(
False,
domain=bool,
description=(
"Generate SMPS files using explicit scenarios "
"(or bundles). ** This option is deprecated. It is "
"the default behavior. ** "
),
doc=None,
visibility=0))
def runadmm_register_options(options=None):
if options is None:
options = PySPConfigBlock()
ADMMSolver.register_options(options)
ScenarioTreeManagerFactory.register_options(options)
safe_register_common_option(options,
"verbose")
safe_register_common_option(options,
"disable_gc")
safe_register_common_option(options,
"profile")
safe_register_common_option(options,
"traceback")
safe_register_common_option(options,
"output_solver_log")
safe_register_common_option(options,
"output_scenario_tree_solution")
safe_register_unique_option(
options,
"default_rho",
PySPConfigValue(
1.0,
domain=_domain_positive,
description=(
"The default rho value for all non-anticipative "
"variables. Default is 1.0."
),
doc=None,
visibility=0),
ap_args=("-r", "--default-rho"),
ap_group=_admm_group_label)