示例#1
0
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            runschuripopt_register_options,
            prog='runschuripopt',
            description=(
"""Optimize a stochastic program using the SchurIpopt solver."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(runschuripopt,
                          options,
                          error_label="runschuripopt: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#2
0
def main(args=None):
    #
    # Top-level command that executes the scenario tree server daemon.
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            scenariotreeserver_register_options,
            prog='scenariotreeserver',
            description=(
                """Launches a scenariotreeserver process to manage workers in a
distributed scenario tree."""))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(exec_scenariotreeserver,
                          options,
                          error_label="scenariotreeserver: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#3
0
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            generate_scenario_tree_image_register_options,
            prog='scenario_tree_image',
            description=("""Generate a pdf image of the scenario tree."""))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(generate_scenario_tree_image,
                          options,
                          error_label="scenario_tree_image: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#4
0
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            run_generate_distributed_NL_register_options,
            prog='generate_distributed_NL',
            description=(
"""Converts a scenario tree into multiple NL files with linking
information specified with suffixes."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(run_generate_distributed_NL,
                          options,
                          error_label="generate_distributed_NL: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#5
0
文件: sd.py 项目: SemanticBeeng/pyomo
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            runsd_register_options,
            prog='runsd',
            description=(
"""Optimize a stochastic program using the SD solver."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(runsd,
                          options,
                          error_label="runsd: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#6
0
def main(args=None):
    #
    # Top-level command that executes the scenario tree server daemon.
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            scenariotreeserver_register_options,
            prog='scenariotreeserver',
            description=(
"""Launches a scenariotreeserver process to manage workers in a
distributed scenario tree."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(exec_scenariotreeserver,
                          options,
                          error_label="scenariotreeserver: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#7
0
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            generate_scenario_tree_image_register_options,
            prog='scenario_tree_image',
            description=(
"""Generate a pdf image of the scenario tree."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(generate_scenario_tree_image,
                          options,
                          error_label="scenario_tree_image: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#8
0
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options, extensions = parse_command_line(
            args,
            run_evaluate_xhat_register_options,
            with_extensions={
                'solution_loader_extension': IPySPSolutionLoaderExtension,
                'solution_saver_extension': IPySPSolutionSaverExtension
            },
            prog='evaluate_xhat',
            description=("""Evaluate a non-anticipative solution over the given
scenario tree.  A solution is provided by specifying one or
more plugins implementing the IPySPSolutionLoaderExtension. E.g.,

evaluate_xhat -m ReferenceModel.py -s ScenarioStructure.dat \\
              --solution-loader-extension=pyomo.pysp.plugins.jsonio \\
              --jsonloader-input-name xhat.json

To include plugin specific options in the list of options
output after this message, declare them on the command-line
before the --help flag. E.g.,

evaluate_xhat --solution-loader-extension=pyomo.pysp.plugins.jsonio \\
              --help

This script will fix all non-derived, non-leaf stage
variables to their values specified in the loaded
solution. All other values are from the solution are
ignored."""))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(run_evaluate_xhat,
                          options,
                          cmd_kwds={
                              'solution_loaders':
                              extensions['solution_loader_extension'],
                              'solution_savers':
                              extensions['solution_saver_extension']
                          },
                          error_label="evaluate_xhat: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#9
0
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options, extensions = parse_command_line(
            args,
            run_evaluate_xhat_register_options,
            with_extensions={'solution_loader_extension':
                             IPySPSolutionLoaderExtension,
                             'solution_saver_extension':
                             IPySPSolutionSaverExtension},
            prog='evaluate_xhat',
            description=(
"""Evaluate a non-anticipative solution over the given
scenario tree.  A solution is provided by specifying one or
more plugins implementing the IPySPSolutionLoaderExtension. E.g.,

evaluate_xhat -m ReferenceModel.py -s ScenarioStructure.dat \\
              --solution-loader-extension=pyomo.pysp.plugins.jsonio \\
              --jsonloader-input-name xhat.json

To include plugin specific options in the list of options
output after this message, declare them on the command-line
before the --help flag. E.g.,

evaluate_xhat --solution-loader-extension=pyomo.pysp.plugins.jsonio \\
              --help

This script will fix all non-derived, non-leaf stage
variables to their values specified in the loaded
solution. All other values are from the solution are
ignored."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(run_evaluate_xhat,
                          options,
                          cmd_kwds={'solution_loaders':
                                    extensions['solution_loader_extension'],
                                    'solution_savers':
                                    extensions['solution_saver_extension']},
                          error_label="evaluate_xhat: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#10
0
文件: ef.py 项目: CanLi1/pyomo-1
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options, extensions = parse_command_line(
            args,
            runef_register_options,
            with_extensions={
                'solution_loader_extension': IPySPSolutionLoaderExtension,
                'solution_saver_extension': IPySPSolutionSaverExtension,
                'solution_writer': ISolutionWriterExtension
            },
            prog='runef',
            description=
            ("""Optimize a stochastic program using the Extensive Form (EF) solver."""
             ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(runef,
                          options,
                          cmd_kwds={
                              'solution_loaders':
                              extensions['solution_loader_extension'],
                              'solution_savers':
                              extensions['solution_saver_extension'],
                              'solution_writers':
                              extensions['solution_writer']
                          },
                          error_label="runef: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#11
0
文件: ef.py 项目: Pyomo/pyomo
def main(args=None):
    #
    # Top-level command that executes everything
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options, extensions = parse_command_line(
            args,
            runef_register_options,
            with_extensions={'solution_loader_extension':
                             IPySPSolutionLoaderExtension,
                             'solution_saver_extension':
                             IPySPSolutionSaverExtension,
                             'solution_writer':
                             ISolutionWriterExtension},
            prog='runef',
            description=(
"""Optimize a stochastic program using the Extensive Form (EF) solver."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(runef,
                          options,
                          cmd_kwds={'solution_loaders':
                                    extensions['solution_loader_extension'],
                                    'solution_savers':
                                    extensions['solution_saver_extension'],
                                    'solution_writers':
                                    extensions['solution_writer']},
                          error_label="runef: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
示例#12
0
def main(args=None):
    #
    # Top-level command that executes the extensive form writer.
    # This is segregated from run_ef_writer to enable profiling.
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            compile_scenario_tree_register_options,
            prog='compile_scenario_tree',
            description=(
"""Compresses linear constraints on all scenarios into
sparse matrix form and then pickles the resulting scenario
models. This should enable faster startup time with reduced
memory usage. This script will automatically activate the
'compile_scenario_instances' scenario tree manager flag."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(run_compile_scenario_tree,
                          options,
                          error_label="compile_scenario_tree: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)
def main(args=None):
    #
    # Top-level command that executes the extensive form writer.
    # This is segregated from run_ef_writer to enable profiling.
    #

    #
    # Import plugins
    #
    import pyomo.environ

    #
    # Parse command-line options.
    #
    try:
        options = parse_command_line(
            args,
            compile_scenario_tree_register_options,
            prog='compile_scenario_tree',
            description=(
"""Compresses linear constraints on all scenarios into
sparse matrix form and then pickles the resulting scenario
models. This should enable faster startup time with reduced
memory usage. This script will automatically activate the
'compile_scenario_instances' scenario tree manager flag."""
            ))

    except SystemExit as _exc:
        # the parser throws a system exit if "-h" is specified
        # - catch it to exit gracefully.
        return _exc.code

    return launch_command(run_compile_scenario_tree,
                          options,
                          error_label="compile_scenario_tree: ",
                          disable_gc=options.disable_gc,
                          profile_count=options.profile,
                          traceback=options.traceback)