def runadmm_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")
    ScenarioTreeManagerFactory.register_options(options)
    ADMMSolver.register_options(options)
    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
Esempio n. 2
0
def runadmm_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")
    ScenarioTreeManagerFactory.register_options(options)
    ADMMSolver.register_options(options)
    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
Esempio n. 3
0
def runsd_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")
    ScenarioTreeManagerFactory.register_options(options)
    SDSolver.register_options(options)

    return options
Esempio n. 4
0
def runsd_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")
    ScenarioTreeManagerFactory.register_options(options)
    SDSolver.register_options(options)

    return options
Esempio n. 5
0
def runadmm(options):
    import pyomo.environ

    start_time = time.time()

    with ScenarioTreeManagerFactory(options) \
         as manager:
        manager.initialize()
        print("")
        print("Initializing ADMM solver for stochastic "
              "programming problems")
        with ADMMSolver(options) as admm:
            admm.solve(manager, options.default_rho)

    print("")
    print("Total execution time=%.2f seconds" % (time.time() - start_time))

    return 0
Esempio n. 6
0
def runsd(options):
    import pyomo.environ

    start_time = time.time()

    with ScenarioTreeManagerFactory(options) \
         as manager:
        manager.initialize()
        print("")
        print("Running SD solver for stochastic " "programming problems")
        with SDSolver(options) as sd:
            results = sd.solve(manager)

        print(results)

    print("")
    print("Total execution time=%.2f seconds" % (time.time() - start_time))

    return 0