示例#1
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)

    return options
示例#2
0
文件: admm.py 项目: Pyomo/pyomo
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)

    return options
示例#3
0
文件: ddsip.py 项目: yynst2/pyomo
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 "
                         "times from the command line to specify more "
                         "than one DDSIP option."),
            doc=None,
            visibility=0),
        ap_kwds={'action': 'append'},
        ap_group=_ddsip_group_label)

    return options
示例#4
0
def runschuripopt_register_options(options=None):
    if options is None:
        options = PySPConfigBlock()
    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, "output_solver_log")
    safe_register_common_option(options, "keep_solver_files")
    safe_register_common_option(options, "symbolic_solver_labels")
    ScenarioTreeManagerFactory.register_options(options)
    SchurIpoptSolver.register_options(options)
    # used to populate the implicit SchurIpopt options
    safe_register_unique_option(
        options,
        "solver_options",
        PySPConfigValue((),
                        domain=_domain_tuple_of_str_or_dict,
                        description=("Solver options to pass to SchurIpopt "
                                     "(e.g., relax_integrality=yes). This "
                                     "option can be used multiple times "
                                     "from the command line to specify more "
                                     "than one SchurIpopt option."),
                        doc=None,
                        visibility=0),
        ap_kwds={'action': 'append'},
        ap_group=_schuripopt_group_label)

    return options
示例#5
0
def runsd_register_options(options=None):
    if options is None:
        options = PySPConfigBlock()
    SDSolver.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")
    return options
示例#6
0
def run_evaluate_xhat_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,
                               "scenario_tree_manager")
    safe_register_common_option(options,
                               "output_scenario_tree_solution")
    safe_register_common_option(options,
                               "solution_saver_extension")
    safe_register_common_option(options,
                               "solution_loader_extension")
    safe_register_unique_option(
        options,
        "disable_solution_loader_check",
        PySPConfigValue(
            False,
            domain=bool,
            description=(
                "Indicates that no solution loader extension is required to "
                "run this script, e.g., because the scenario tree manager "
                "is somehow pre-populated with a solution."
            ),
            doc=None,
            visibility=0),
        ap_group=_extension_options_group_title)
    safe_register_unique_option(
        options,
        "output_scenario_costs",
        PySPConfigValue(
            None,
            domain=_domain_must_be_str,
            description=(
                "A file name where individual scenario costs from the solution "
                "will be stored. The format is determined from the extension used "
                "in the filename. Recognized extensions: [.csv, .json, .yaml]"
            ),
            doc=None,
            visibility=0))
    ScenarioTreeManagerFactory.register_options(options)
    ScenarioTreeManagerSolverFactory.register_options(options,
                                                      options_prefix="subproblem_")

    return options
示例#7
0
文件: schuripopt.py 项目: Pyomo/pyomo
def runschuripopt_register_options(options=None):
    if options is None:
        options = PySPConfigBlock()
    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,
                                "output_solver_log")
    safe_register_common_option(options,
                                "keep_solver_files")
    safe_register_common_option(options,
                                "symbolic_solver_labels")
    ScenarioTreeManagerFactory.register_options(options)
    SchurIpoptSolver.register_options(options)
    # used to populate the implicit SchurIpopt options
    safe_register_unique_option(
        options,
        "solver_options",
        PySPConfigValue(
            (),
            domain=_domain_tuple_of_str_or_dict,
            description=(
                "Solver options to pass to SchurIpopt "
                "(e.g., relax_integrality=yes). This "
                "option can be used multiple times "
                "from the command line to specify more "
                "than one SchurIpopt option."
            ),
            doc=None,
            visibility=0),
        ap_kwds={'action': 'append'},
        ap_group=_schuripopt_group_label)

    return options
示例#8
0
文件: ddsip.py 项目: Pyomo/pyomo
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 "
                "times from the command line to specify more "
                "than one DDSIP option."
            ),
            doc=None,
            visibility=0),
        ap_kwds={'action': 'append'},
        ap_group=_ddsip_group_label)

    return options
示例#9
0
def run_evaluate_xhat_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, "scenario_tree_manager")
    safe_register_common_option(options, "output_scenario_tree_solution")
    safe_register_common_option(options, "solution_saver_extension")
    safe_register_common_option(options, "solution_loader_extension")
    safe_register_unique_option(
        options,
        "disable_solution_loader_check",
        PySPConfigValue(
            False,
            domain=bool,
            description=(
                "Indicates that no solution loader extension is required to "
                "run this script, e.g., because the scenario tree manager "
                "is somehow pre-populated with a solution."),
            doc=None,
            visibility=0),
        ap_group=_extension_options_group_title)
    safe_register_unique_option(
        options, "output_scenario_costs",
        PySPConfigValue(
            None,
            domain=_domain_must_be_str,
            description=
            ("A file name where individual scenario costs from the solution "
             "will be stored. The format is determined from the extension used "
             "in the filename. Recognized extensions: [.csv, .json, .yaml]"),
            doc=None,
            visibility=0))
    ScenarioTreeManagerFactory.register_options(options)
    ScenarioTreeManagerSolverFactory.register_options(
        options, options_prefix="subproblem_")

    return options
示例#10
0
    ScenarioTreeManagerFactory
from pyomo.pysp.solvers.benders import BendersAlgorithm

# *** How to run this example using Pyro ***:
#
# To run this example using Pyro, launch the following
# command in another terminal:
#   $ mpirun -np 1 pyomo_ns -r -n localhost : \
#            -np 1 dispatch_srvr -n localhost : \
#            -np 3 scenariotreeserver --pyro-host=localhost --traceback
#
# In this shell launch:
#   $ python benders_scripting.py
# with sp_options.scenario_tree_manager = "pyro"

sp_options = ScenarioTreeManagerFactory.register_options()

# To see detailed information about options
#for name in sp_options.keys():
#    print(sp_options.about(name))

# To see a more compact display of options
#sp_options.display()

#
# General options for the scenario tree manager
#
sp_options.scenario_tree_manager = "serial"
# using absolute paths so we can automate testing
# of this example
examplesdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
示例#11
0
    ScenarioTreeManagerFactory
from pyomo.pysp.solvers.benders import BendersAlgorithm

# *** How to run this example using Pyro ***:
#
# To run this example using Pyro, launch the following
# command in another terminal:
#   $ mpirun -np 1 pyomo_ns -r -n localhost : \
#            -np 1 dispatch_srvr -n localhost : \
#            -np 3 scenariotreeserver --pyro-host=localhost --traceback
#
# In this shell launch:
#   $ python benders_scripting.py
# with sp_options.scenario_tree_manager = "pyro"

sp_options = ScenarioTreeManagerFactory.register_options()

# To see detailed information about options
#for name in sp_options.keys():
#    print(sp_options.about(name))

# To see a more compact display of options
#sp_options.display()

#
# General options for the scenario tree manager
#
sp_options.scenario_tree_manager = "serial"
# using absolute paths so we can automate testing
# of this example
examplesdir = os.path.dirname(