Exemplo n.º 1
0
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()

        safe_declare_common_option(options, "extension_precedence")

        return options
Exemplo n.º 2
0
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()

        safe_declare_common_option(options, "input_name")
        safe_declare_common_option(options, "load_stages")

        return options
Exemplo n.º 3
0
 def _declare_options(cls, options=None):
     if options is None:
         options = PySPConfigBlock()
     safe_declare_common_option(options,
                                "verbose",
                                ap_group=_admm_group_label)
     ScenarioTreeManagerSolverFactory.register_options(
         options, options_prefix="subproblem_", setup_argparse=False)
     return options
Exemplo n.º 4
0
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()

        safe_declare_common_option(options, "preprocess_fixed_variables")
        safe_declare_common_option(options, "symbolic_solver_labels")
        safe_declare_common_option(options, "output_times")
        safe_declare_common_option(options, "verbose")

        return options
Exemplo n.º 5
0
 def _declare_options(cls, options=None):
     if options is None:
         options = PySPConfigBlock()
     safe_declare_common_option(options,
                                "max_iterations",
                                ap_group=_admm_group_label)
     safe_declare_unique_option(
         options,
         "primal_residual_relative_tolerance",
         PySPConfigValue(
             1.0e-4,
             domain=_domain_positive,
             description=(
                 "Relative primal-residual tolerance. Default is 1e-4."),
             doc=None,
             visibility=0),
         ap_group=_admm_group_label)
     safe_declare_unique_option(
         options,
         "dual_residual_relative_tolerance",
         PySPConfigValue(
             1.0e-4,
             domain=_domain_positive,
             description=(
                 "Relative dual-residual tolerance. Default is 1e-4."),
             doc=None,
             visibility=0),
         ap_group=_admm_group_label)
     ADMMAlgorithm._declare_options(options)
     for rstype in RhoStrategyFactory.registered_types.values():
         rstype._declare_options(options)
     assert 'adaptive' in RhoStrategyFactory.registered_types
     safe_declare_unique_option(
         options,
         "rho_strategy",
         PySPConfigValue(
             'adaptive',
             domain=_domain_must_be_str,
             description=
             ("Rho update strategy. Choices are: %s. Default is 'adaptive'."
              % (str(sorted(RhoStrategyFactory.registered_types.keys())))),
             doc=None,
             visibility=0),
         ap_group=_admm_group_label)
     return options
Exemplo n.º 6
0
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()

        #
        # scenario instance construction
        #
        safe_declare_common_option(options,
                                   "objective_sense_stage_based")
        safe_declare_common_option(options,
                                   "output_instance_construction_time")
        safe_declare_common_option(options,
                                   "compile_scenario_instances")

        #
        # various
        #
        safe_declare_common_option(options,
                                   "verbose")
        safe_declare_common_option(options,
                                   "profile_memory")

        return options
Exemplo n.º 7
0
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()
        safe_declare_unique_option(
            options,
            "firststage_suffix",
            PySPConfigValue(
                "__DDSIP_FIRSTSTAGE",
                domain=_domain_must_be_str,
                description=("The suffix used to identity first-stage "
                             "variables to DDSIP. Default is "
                             "'__DDSIP_FIRSTSTAGE'"),
                doc=None,
                visibility=0),
            ap_group=_ddsip_group_label)
        safe_declare_unique_option(
            options,
            "config_file",
            PySPConfigValue(
                None,
                domain=_domain_must_be_str,
                description=(
                    "The name of a partial DDSIP configuration file "
                    "that contains option specifications unrelated to "
                    "the problem structure. If specified, the contents "
                    "of this file will be appended to the "
                    "configuration created by this solver interface. "
                    "Default is None."),
                doc=None,
                visibility=0),
            ap_group=_ddsip_group_label)
        safe_declare_common_option(options,
                                   "verbose",
                                   ap_group=_ddsip_group_label)

        return options
Exemplo n.º 8
0
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()

        # options for controlling the solver manager
        # (not the scenario tree manager)
        safe_declare_common_option(options,
                                   "solver_manager_pyro_host")
        safe_declare_common_option(options,
                                   "solver_manager_pyro_port")
        safe_declare_common_option(options,
                                   "solver_manager_pyro_shutdown")

        ScenarioTreePreprocessor._declare_options(options)

        return options
Exemplo n.º 9
0
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()

        safe_declare_unique_option(
            options,
            "cvar_weight",
            PySPConfigValue(
                1.0,
                domain=_domain_nonnegative,
                description=(
                    "The weight associated with the CVaR term in "
                    "the risk-weighted objective "
                    "formulation. If the weight is 0, then "
                    "*only* a non-weighted CVaR cost will appear "
                    "in the EF objective - the expected cost "
                    "component will be dropped. Default is 1.0."
                ),
                doc=None,
                visibility=0),
            ap_group=_ef_group_label)
        safe_declare_unique_option(
            options,
            "generate_weighted_cvar",
            PySPConfigValue(
                False,
                domain=bool,
                description=(
                    "Add a weighted CVaR term to the "
                    "primary objective. Default is False."
                ),
                doc=None,
                visibility=0),
            ap_group=_ef_group_label)
        safe_declare_unique_option(
            options,
            "risk_alpha",
            PySPConfigValue(
                0.95,
                domain=_domain_unit_interval,
                description=(
                    "The probability threshold associated with "
                    "CVaR (or any future) risk-oriented "
                    "performance metrics. Default is 0.95."
                ),
                doc=None,
                visibility=0),
            ap_group=_ef_group_label)
        safe_declare_unique_option(
            options,
            "cc_alpha",
            PySPConfigValue(
                0.0,
                domain=_domain_unit_interval,
                description=(
                    "The probability threshold associated with a "
                    "chance constraint. The RHS will be one "
                    "minus this value. Default is 0."
                ),
                doc=None,
                visibility=0),
            ap_group=_ef_group_label)
        safe_declare_unique_option(
            options,
            "cc_indicator_var",
            PySPConfigValue(
                None,
                domain=_domain_must_be_str,
                description=(
                    "The name of the binary variable to be used "
                    "to construct a chance constraint. Default "
                    "is None, which indicates no chance "
                    "constraint."
                ),
                doc=None,
                visibility=0),
            ap_group=_ef_group_label)
        safe_declare_unique_option(
            options,
            "mipgap",
            PySPConfigValue(
                None,
                domain=_domain_unit_interval,
                description=(
                    "Specifies the mipgap for the EF solve."
                ),
                doc=None,
                visibility=0),
            ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "solver")
        safe_declare_common_option(options,
                                   "solver_io")
        safe_declare_common_option(options,
                                   "solver_manager")
        safe_declare_common_option(options,
                                   "solver_options")
        safe_declare_common_option(options,
                                   "disable_warmstart")
        safe_declare_common_option(options,
                                   "pyro_host")
        safe_declare_common_option(options,
                                   "pyro_port")
        safe_declare_common_option(options,
                                   "pyro_shutdown")
        safe_declare_common_option(options,
                                   "verbose",
                                   ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "output_times",
                                   ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "output_solver_results",
                                   ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "symbolic_solver_labels",
                                   ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "output_solver_log",
                                   ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "verbose",
                                   ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "output_times",
                                   ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "keep_solver_files",
                                   ap_group=_ef_group_label)
        safe_declare_common_option(options,
                                   "output_solver_results",
                                   ap_group=_ef_group_label)

        return options
Exemplo n.º 10
0
Arquivo: sd.py Projeto: ramoneim/pysp
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()
        safe_declare_unique_option(
            options,
            "stopping_rule_tolerance",
            PySPConfigValue(
                "nominal",
                domain=_domain_sd_tolerance,
                description=("Stopping rule tolerance used by the SD solver. "
                             "Must be one of: %s. Default is 'nominal'." %
                             (str(_domain_sd_tolerance._values))),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "single_replication",
            PySPConfigValue(
                False,
                domain=bool,
                description=("Disables multiple replication procedure in "
                             "SD and uses a single replication."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "print_cycle",
            PySPConfigValue(
                100,
                domain=_domain_positive_integer,
                description=("Number of iterations between output of "
                             "solution data to screen and file."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "eval_run_flag",
            PySPConfigValue(
                False,
                domain=bool,
                description=(
                    "Set to evaluate on the run. This should be "
                    "only used for instances with relatively complete "
                    "recourse. This flag is not recommended because "
                    "accurate function evaluations are unnecessarily "
                    "time consuming. It is best to use a large print "
                    "cycle when this option is activated."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "eval_flag",
            PySPConfigValue(
                False,
                domain=bool,
                description=(
                    "Set to get an estimated objective function value "
                    "for the final incumbent of each replication."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "eval_seed1",
            PySPConfigValue(
                2668655841019641,
                domain=int,
                description=(
                    "Random number seed for re-sampling omegas during "
                    "optimality test. Default is None, meaning no "
                    "seed will be provided."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "eval_error",
            PySPConfigValue(
                0.01,
                domain=_domain_positive,
                description=(
                    "Objective evaluation is accurate to within "
                    "this much, with 95%% confidence. Default is 0.01."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "mean_dev",
            PySPConfigValue(
                0.05,
                domain=_domain_positive,
                description=("Solution tolerance for deciding the usage of "
                             "mean solution. Default is 0.05."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "min_iterations",
            PySPConfigValue(
                None,
                domain=_domain_nonnegative_integer,
                description=("Number of iterations which must pass before "
                             "optimality is checked. Default is None, meaning "
                             "no minimum is given."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_unique_option(
            options,
            "max_iterations",
            PySPConfigValue(
                5000,
                domain=_domain_positive_integer,
                description=("Maximum number of iterations for any given "
                             "problem. Default is 5000."),
                doc=None,
                visibility=0),
            ap_group=_sd_group_label)
        safe_declare_common_option(options,
                                   "verbose",
                                   ap_group=_sd_group_label)

        return options
Exemplo n.º 11
0
 def _declare_options(cls, options=None):
     if options is None:
         options = PySPConfigBlock()
     safe_declare_common_option(options, "verbose")
     return options
Exemplo n.º 12
0
    def _declare_options(cls, options=None):
        if options is None:
            options = PySPConfigBlock()

        #
        # solve and I/O related
        #
        safe_declare_common_option(options,
                                   "symbolic_solver_labels")
        safe_declare_common_option(options,
                                   "solver_options")
        safe_declare_common_option(options,
                                   "solver")
        safe_declare_common_option(options,
                                   "solver_io")
        safe_declare_common_option(options,
                                   "solver_manager")
        safe_declare_common_option(options,
                                   "disable_warmstart")
        safe_declare_common_option(options,
                                   "disable_advanced_preprocessing")
        safe_declare_common_option(options,
                                   "output_solver_log")
        safe_declare_common_option(options,
                                   "keep_solver_files")
        safe_declare_common_option(options,
                                   "comparison_tolerance_for_fixed_variables")

        return options