B @`r @sdZddlZddlZddlZddlZddlmZmZddlm Z m Z ddl Z ddl Z e dZGdddeZGdd d eZdbd d ZdcddZddddZdeddZedZddZde_ddZde_ddZde_ddZd e_Gd!d"d"eZd#d$Zd%e_d&d'Zd%e_d(d)Zd*e_d+d,Z d-e _d.d/Z!d0e!_d1Z"eed2ed3ed4ddd5d6e"d d7eed8eded9ddd5d:e"d d7e d;ddgZ#d?d@Z$eedAede$dBddd5dCdDe#ie"d dEeedFede dGddd5dHdIie"d dJeedKede dLddd5dHdIie"d dJdMZ%eedNede&dOddd5e%dPeedQedRedSddd5e%dPeedTedddUddd5e%dPeedVededWddd5e%dPeedXedYedZddd5e%dPd[Z'eed\eded]ddd5e'dPeed^ede&d_ddd5e'dPeed`ed e(daddd5e'dPeedbededcddd5e'dPeeddedee)dfddd5e'dPeedged e(dhddd5e'dPeedied e(djddd5e'dPdkZ*eedled e(dmddd5e*dPeedned e(doddd5e*dPeedped e(dqddd5e*dPeedredRe&dsddd5e*dPeedted e(duddd5e*dPeedved e(dwddd5e*dPeedxed e(dyddd5e*dPeedzed e(d{ddd5e*dPeed|ed e(d}ddd5e*dPd~Z+eedededddd5e+dPeedededddd5e+dPddZ,eedede,dddd5de+d d7dddgZ-ddZ.eedede.dddd5dDe-ie+d dJeeded e(dddd5e+dPeedede)dddd5e+dPeeded e(dddd5e+dPeededRedddd5e+dPeedededddd5e+dPeedede)dddd5e+dPeedede)dddd5e+dPeeded e(dddd5e+dPeedededddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeedede)dddd5e+dPeedededddd5e+dPeedede&dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPeeded e(dddd5e+dPdZ/eeded e(dddd5e/dPeedededddd5e/dPeedededddd5e/dPeedede dddd5dHdIie/d dJeedede dddd5dHdIie/d dJeedede&dddd5e/dPeedededddd5e/dPeedededddd5e/dPeedede dddd5dHdIie/d dJeedede dddd5dHdIie/d dJeedededddd5e/dPeedededddd5e/dPdZ0eeded e(dddd5e0dPeeded e(dddd5e0dPeeded e(dddd5e0dPeeded e(dddd5e0dPdZ1eedededddd5e1dPeedede!dddd5dHdIie1deedededddd5e1dPeedededddd5e1dPeededYedddd5e1dPeeded e(dddd5e1dPeedededddd5e1dPeedede&dddd5e1dPeeded e(dddd5e1dPdZ2eeded e(dddd5e2dPeedededddd5e2dPeedededddd5e2dPeeded e(dddd5e2dPeeded e(dddd5e2dPiZ3edZ4dZ5Gddde j6Z7d d Z8ee4d ede8d ddRd5d dHe7ie5d dEe49d e3d2<Gddde j6Z:ddZ;ee4dede;dddRd5ddHe:ie5d dEe49de3d8<Gddde j6Z<ddZ=ee4dede=dddRd5dHeddZ?ee4dede?d ddRd5dHe>ie5d dJe49de3db<Gd!d"d"e j6Z@d#d$ZAee4d%edeAd&ddRd5dHe@ie5d dJe49d%e3dd<Gd'd(d(e j6ZBd)d*ZCee4d+edeCd,ddRd5dHeBie5d dJe49d+e3d<Gd-d.d.e j6ZDd/d0ZEee4d1edeEd2ddRd5dHeDie5d dJe49d1e3dN<Gd3d4d4e j6ZFd5d6ZGee4d7edeGd8ddRd5dHeFie5d dJe49d7e3d<Gd9d:d:e j6ZHGd;d<dZJee4d?edeJd@ddRd5dHeIie5d dJe49d?e3dF<GdAdBdBe j6ZKdCdDZLee4dEedeLdFddRd5dHeKie5d dJe49dEe3dK<GdGdHdHe j6ZMdIdJZNee4dKedeNdLddRd5dHeMie5d dJe49dKe3dg<GdMdNdNe j6ZOdOdPZPee4dQedePdRddRd5dHeOie5d dJe49dQe3di<dfdSdTZQdgdUdVZReSdWkrddlTZUGdXdYdYeZVGdZd[d[eZWeZXeWYeXeXZd\ee [Z\eX]e\eX^e\_e`de`eXjae`eXjbe`ecd]d^eXdDe`ecd_d^eXeDe`d`x&e3D]Zfe`e3efjgdaefqvWdS(hN) ConfigValue ConfigBlock)maximizeminimizez pyomo.pyspcs8eZdZdZfddZfddZddZeZZS)PySPConfigValue)ap_groupap_kwdsap_argscs(tt|j||d|_d|_i|_dS)Nr)superr__init__rr r )selfargskwds) __class__r:/tmp/pip-unpacked-wheel-bi3529v6/pyomo/pysp/util/config.pyr DszPySPConfigValue.__init__cs0tt|}xtjD]}t||||<qW|S)N)r r __getstate__ __slots__getattr)r anskey)rrrrJs zPySPConfigValue.__getstate__cCsd|jj|jfS)Nz %s(name=%s))r__name___name)r rrr__str__PszPySPConfigValue.__str__) r __module__ __qualname__rr rr__repr__ __classcell__rr)rrrAs   rcsPeZdZddZdfdd ZfddZdd Zfd d Zdd dZZ S)PySPConfigBlockcCs||}d|jj|jf}|dt|jdr4|jjn|j|jf7}|jdkrVdg}nt j |jdd}x|d d kr| qhWxNt |D]B\}}|d krd }nd }|t|d kr|d7}||;}||7}qW|S)zGReturn a summary string for an option registered on this block.z%s: %s z - type: %s - default: %s docNNone:)widthrz - doc: %sz %s )getrrrhasattr_domainr_default _descriptiontextwrapwrapstrippop enumeratelen)r nameZ configvaloutstrlinesilinetmprrraboutWs.      zPySPConfigBlock.aboutNc sfytt|jfd|i|WnBtk r`tt|jf|}|dkrRt|n ||YnXdS)zDisplays the list of options registered to this block. The optional keyword 'ostream' can be a file like object to write to.ostreamN)r rdisplay TypeErrorprintwrite)r r9rr3)rrrr:}s zPySPConfigBlock.displaycs0|tjkrtt|||nt|||dS)N)rZ _all_slotsr __setattr__ __setitem__)r r2value)rrrr>s zPySPConfigBlock.__setattr__cCsT||jkr0|dd}||jkr,td||}d|j|_|j|=|j|dS)N_ zUnknown attribute '%s')_datareplaceAttributeError_parentZ _decl_orderremove)r r2rrrr __delattr__s     zPySPConfigBlock.__delattr__cs"tt|||}d|_d|_|S)NTF)r radd_userSet)r r2configr)rrrrIszPySPConfigBlock.addTcCsptdd|D}t|rld}x$t|D]}|d|||f7}q,W|d7}t||rht|ndSdS)aCheck for usage of options that have set by a user. Args: error (bool): When :const:`True` (default), an exception is raised when any options set by the user have not been accessed by any code. Otherwise, a warning is logged. Returns: :const:`True` when all options set by the user have been accessed; otherwise, returns :const:`False` if the :attr:`error` keyword is set to :const:`False`. Raises: ValueError: when user-set options exist but have not been accessed (and the :attr:`error` keyword is :const:`True`) css|]}|j|dfVqdS)FN)rr@).0_crrr sz.PySPConfigBlock.check_usage..z>The following options were explicitly set but never accessed: z - %s: %s zGIf you believe this is a bug, please report it to the PySP developers. FT)dictunused_user_valuesr1sortedloggerwarning ValueError)r errorZignored_optionsmsgr2rrr check_usages  zPySPConfigBlock.check_usage)N)T) rrrr8r:r>rHrIrWrrr)rrrUs &  rTcCst|tstt|tst|j|jkr|j|jkr|j|jkr|j|jkr|r\|j|jkr|rl|j|jkr|r||j |j kr|r|j |j kr|r|j |j krdSd}|j|jkr|d7}|dt |jd7}|dt |jd7}|j|jkr&|d7}|dt |jd7}|dt |jd7}|j|jkrh|d7}|dt |jd7}|dt |jd7}|j|jkr|d7}|d t |jd7}|d t |jd7}|r|j|jkr|d7}|d t |jd7}|d t |jd7}|r:|j|jkr:|d7}|d t |jd7}|dt |jd7}|r|j |j kr|d7}|dt |j d7}|dt |j d7}|r|j |j kr|d7}|dt |j d7}|dt |j d7}|r|j |j kr|d7}|dt |j d7}|dt |j d7}t |dS)NzAOptions do not match. This is likely a developer error. Summary: r&zopt1._domain: zopt2._domain: zopt1._description: zopt2._description: z opt1._doc: z opt2._doc: zopt1._visibility: zopt2._visibility: zopt1._argparse: zopt2._argparse: zopt1._default: zopt2._default: z opt1._data: z opt2._data: zopt1._userSet: zopt2._userSet: zopt1._userAccessed: zopt2._userAccessed: ) isinstancerAssertionErrorr)r+_docZ _visibility _argparser*rCrJ _userAccessedstrrT)opt1opt2include_argparseinclude_default include_valueinclude_accessedrVrrrcheck_options_matchsd     rdFc Cst|tst|jdkst|jdks*t|jdks8t|dk rVt|tjsPt||_|dk rtt |t ksnt||_ |dk rt |t kst||_ ||kr0||t||r||jdkst|dkr||j }|dkr||j }||jdk rd|kr||j|d<||j||n||}t||| dddd|r|jdksft|dkrv|j }|dkr|j }|jdk rd|kr|j|d<|j||dS)NFgroup)rar`rbrc)rXrrYrFrJr\six string_typesrtypetupler rOr declarecopydeepcopyr'r[declare_as_argumentrd) configblockr2 configvaluerZrelax_default_checkdeclare_for_argparser r currentrrrsafe_declare_optionsZ             rrc Cst|tst|jdkst|jdks*t|jdks8t||krLtd||dk rjt|tjsdt||_ |dk rt |t kst||_ |dk rt |t kst||_||t|||jdkst|rD|dkr||j }|dkr||j}||j dk r&d|kr&||j |d<||j|||rtnl|r|tkrt|}|jtkslt|jdks|t|jdkstd|_t|} t|_|| j| dS)NFz[Option registration failed. An option with name '%s' already exists on the PySPConfigBlock.re)rXrrYrFrJr\ RuntimeErrorrfrgrrhrir rOr rjrkrlr'r[rm_map_to_deprecated_deprecated_blockr) rnr2rorrpr r Zcheck_for_deprecateddeprecated_valuedeprecated_value_copyrrrsafe_declare_unique_optionYsV        rxc Cst||||||dddS)NT)rr r rp)rx)rnr2rorr r rrrsafe_register_unique_optionsryz#A collection of common PySP optionscCs.t|}d|krdks*ntd||S)Nrr%z&Value %s is not in the interval [0,1].)floatrT)valrrr_domain_unit_intervals r|z%cCs*t|}d|krdks&ntd|S)Nrdz!Value %s is not between 0 and 100)rzrT)r{rrr_domain_percents r~z'cCs t|}|dkrtd||S)Nrz'Value %s is not a non-negative integer.)intrT)r{rrr_domain_nonnegative_integers rzcCs t|}|dkrtd||S)Nrz#Value %s is not a positive integer.)rrT)r{rrr_domain_positive_integers rzc@seZdZddZddZdS)_domain_integer_intervalcCsV||ks tt||kstt||ks,tt||_t||_d|j|jf|_dS)Nz"cCs t|}|dkrtd||S)NrzValue %s is not positive.)rzrT)r{rrr_domain_positives rcCs t|tjstdt||S)Nz.Value must be a built-in string type, not '%s')rXrfrgr;rh)r{rrr_domain_must_be_strs   rzcCsrt|tjr|fSt|ttfs2tdt|n.)rXrfrglistrir;rh)r{rrrr_domain_tuple_of_strs   rzcCst|tjr|fSt|ttfr\x(|D] }t|tjs&tdt|q&Wtdd|DSt|trx(|D] }t|tjsltdt|qlW|Stdt|dS)Nz.Value must be a built-in string type, not '%s'css|] }|VqdS)Nr)rLrrrrrNsz/_domain_tuple_of_str_or_dict..z2Dict keys must be a built-in string type, not '%s'zKValue must be a built-in list or tuple of string types, or a dict, not '%s')rXrfrgrrir;rhrO)r{rrrr_domain_tuple_of_str_or_dict s&      rz!z Input Optionsmodel_location.aThe directory or filename where the reference model is found. If a directory is given, the reference model is assumed to reside in a file named 'ReferenceModel.py' under that directory. If the reference model file contains a function named 'pysp_instance_creation_callback', it will be called to construct each scenario model (not necessarily by the same running process). Otherwise, the reference model file must contain an AbstractModel object named 'model'. Default is '.'. )domain descriptionrZ visibility)z-mz--model-location)r rrpscenario_tree_locationaThe directory or filename where the scenario tree structure .dat file is found. If a directory is given, the scenario tree structure is assumed to reside in a file named 'ScenarioStructure.dat' under that directory. The location of any required scenario data files will also be inferred from the value of this option. If unspecified, the reference model file must define a function named 'pysp_scenario_tree_model_callback' and must be in the same location as any required scenario data files.)z-sz--scenario-tree-locationmaxrminrcCsD|ddtfkrtS|ddtfkr$tS|dkr0dStd|tfdS)Nrrrrz*Invalid choice: %s. (choose from one of %s)rrrT_objective_sense_choices)r{rrr_objective_sense_domainZsrobjective_sense_stage_baseda$The objective sense to use when auto-generating the scenario instance objective function, which is equal to the sum of the scenario-tree stage costs declared on the reference model. If unspecified, it is assumed a stage-cost based objective function has been declared on the reference model.)z-oz--objective-sense-stage-basedchoices)r r rrppostinit_callback_locationaFile that contains a 'pysp_postinit_callback' function, which is executed on each scenario at the end of scenario tree manager initialization. If the scenario tree is distributed, then this callback will be transmitted to the respective scenario tree workers where the constructed scenario instances are available. This callback can be used to update things like variable bounds as well as other scenario-specific information stored on the Scenario objects. This callback will be executed immediately after any 'pysp_aggregategetter_callback' function that is specified. This option can be used multiple times from the command line to specify more than one callback function location.actionappend)r rrpZ!aggregategetter_callback_locationa0File that contains a 'pysp_aggregategetter_callback' function, which is executed in a sequential call chain on each scenario at the end of scenario tree manager initialization. Most useful in cases where the scenario tree is distributed across multiple processes, it can be used to execute arbitrary code whose return value is passed as input into the next call in the chain. At the end of the call chain, the final result is broadcast to all scenario tree worker processes and stored under the name _aggregate_user_data on the worker object. Potential uses include collecting aggregate scenario information that is subsequently used by a 'pysp_postinit_callback' function to set tight variable bounds. This option can be used multiple times from the command line to specify more than one callback function location.zScenario Tree OptionsZscenario_tree_random_seedzThe random seed associated with manipulation operations on the scenario tree (e.g., down-sampling or bundle creation). Default is None, indicating unassigned.)rZ!scenario_tree_downsample_fractionr%zThe proportion of the scenarios in the scenario tree that are actually used. Specific scenarios are selected at random. Default is 1.0, indicating no down-sampling.Zscenario_bundle_specificationaThe name of the scenario bundling specification to be used when generating the scenario tree. Default is None, indicating no bundling is employed. If the specified name ends with a .dat suffix, the argument is interpreted as the path to a file. Otherwise, the name is interpreted as a file in the instance directory, constructed by adding the .dat suffix automatically. If scripting, this option can alternatively be assigned a dictionary mapping bundle names to a list of scenario names.Zcreate_random_bundleszSpecification to create the indicated number of random, equally-sized (to the degree possible) scenario bundles. Default is 0, indicating no scenario bundles will be created.Zscenario_tree_managerseriala&The type of scenario tree manager to use. The default, 'serial', builds all scenario instances on the parent process and performs all scenario tree operations sequentially. If 'pyro' is specified, the scenario tree is fully distributed and scenario tree operations are performed asynchronously.z Pyro OptionsZ pyro_hostz=The hostname to bind on when searching for a Pyro nameserver.Z pyro_portz9The port to bind on when searching for a Pyro nameserver.Zpyro_handshake_at_startupzTake extra steps to acknowledge Pyro-based requests are received by workers during pyro scenario tree manager initialization. This option can be useful for debugging connection issues during startup.Z!pyro_required_scenariotreeserversaSet the number of idle scenario tree server processes expected to be available when the 'pyro' scenario tree manager is selected. This option should be used when the number of workers is less than the total number of scenarios (or bundles). The default value of 0 indicates that the manager should attempt to assign each scenario (or bundle) to a single scenariotreeserver process until the timeout (indicated by the pyro_find_scenariotreeservers_timeout option) occurs.Z%pyro_find_scenariotreeservers_timeoutzSet the time limit (seconds) for finding idle scenario tree server processes when the 'pyro' scenario tree manager is selected. This option is ignored when pyro_required_scenariotreeservers is used. Default is 30 seconds.Z pyro_shutdowna=Attempt to shut down all Pyro-related components associated with the Pyro name server for the scenario tree manager. Components to shutdown include the name server, dispatch server, and any scenariotreeserver registered with the dispatcher. Note that if Pyro4 is in use the nameserver will always ignore this request.Zpyro_shutdown_workersa Upon exit, send shutdown requests to all worker processes that were acquired through the dispatcher used by the scenario tree manager. This leaves any dispatchers and namservers running as well as any processes registered with the dispather that were not acquired for work by this client.zOutput OptionsZoutput_solver_resultsz@Output solutions obtained after each scenario sub-problem solve.Zoutput_scenario_tree_solutionzOReport the solution in scenario tree format upon termination. Default is False.Zsymbolic_solver_labelsa|When interfacing with the solver, use symbol names derived from the model. For example, 'my_special_variable[1_2_3]' instead of 'x552'. Useful for debugging. When using NL file based solvers, this option results in corresponding .row (constraints) and .col (variables) file being created. The ordering in these files provides a mapping from NL file index to symbolic model names.Zfile_determinismanWhen interfacing with a solver using file based I/O, set the effort level for ensuring the file creation process is determistic. The default (1) sorts the index of components when transforming the model. Anything less than 1 disables index sorting and can speed up model I/O. Anything greater than 1 additionaly sorts by component name to override declartion order.Zoutput_solver_logz Output solver log during solves.Z output_timesz7Output timing statistics during various runtime stages.Z!output_instance_construction_timezOutput timing information during instance construction. This option will be ignored when a 'pysp_instance_creation_callback' function is defined inside the reference model file.Zkeep_solver_fileszHRetain temporary input and output files for scenario sub-problem solves.verbosez>Generate verbose output for both initialization and execution.z PH OptionsZph_warmstart_filer$zhDisable iteration 0 solves and warmstart rho, weight, and xbar parameters from solution or history file.Zph_warmstart_indexzMIndicates the iteration inside a history file from which to load a warmstart.cCs t|}|dkrtd||S)NrzFInvalid value for default rho: %s. Value must be non-negative or None.)rzrT)r{rrr _rho_domainBs rZ default_rhozMThe default PH rho value for all non-anticipative variables. *** Required ***)z-rz --default-rhozclosest-scenarioZvotingroundingcCs |tkr |Std|tfdS)Nz*Invalid choice: %s. (choose from one of %s)_xhat_method_choicesrT)r{rrr_xhat_method_domain]s rZ xhat_methodzSpecify the method used to compute a bounding solution at PH termination. Defaults to 'closest-scenario'. Other variants are: 'voting' and 'rounding'.Z overrelaxzSCompute weight updates using combination of previous and current variable averages.nug?zAParameter used to update weights when using the overrelax option.asyncz-Run PH in asychronous mode after iteration 0.Zasync_buffer_lengthzkNumber of scenarios to collect, if in async mode, before doing statistics and weight updates. Default is 1.Zmax_iterationsr}z4The maximal number of PH iterations. Default is 100.Z ph_timelimitzALimits the number of seconds spent inside the solve method of PH.Ztermdiff_thresholdg-C6?zqThe convergence threshold used in the term-diff and normalized term-diff convergence criteria. Default is 0.0001.Z&enable_free_discrete_count_convergencezJTerminate PH based on the free discrete variable count convergence metric.Zfree_discrete_count_thresholdzThe convergence threshold used in the criterion based on when the free discrete variable count convergence criterion. Default is 20.Z&enable_normalized_termdiff_convergencezSTerminate PH based on the normalized termdiff convergence metric. Default is True. Zenable_termdiff_convergencez6Terminate PH based on the termdiff convergence metric.Zenable_outer_bound_convergencez9Terminate PH based on the outer bound convergence metric.Z!outer_bound_convergence_thresholdzpThe convergence threshold used in the outer bound convergence criterion. Default is None, indicating unassigned.Z!linearize_nonbinary_penalty_termszApproximate the PH quadratic term for non-binary variables with a piece-wise linear function, using the supplied number of equal-length pieces from each bound to the average. The default value of 0 indications no linearization shall take place.Zbreakpoint_strategya,Specify the strategy to distribute breakpoints on the [lb, ub] interval of each variable when linearizing. 0 indicates uniform distribution. 1 indicates breakpoints at the node min and max, uniformly in-between. 2 indicates more aggressive concentration of breakpoints near the observed node min/max.Zretain_quadratic_binary_termszHDo not linearize PH objective terms involving binary decision variables.Zdrop_proximal_termsz\Eliminate proximal terms (i.e., the quadratic penalty terms) from the weighted PH objective.Zreport_solutionszVAlways report PH solutions after each iteration. Enabled if verbose output is enabled.Zreport_weightszWAlways report PH weights prior to each iteration. Enabled if verbose output is enabled.Zreport_rhos_each_iterationz.Always report PH rhos prior to each iteration.Zreport_rhos_first_iterationzEReport rhos prior to PH iteration 1. Enabled if --verbose is enabled.Zreport_for_zero_variable_valuesziReport statistics (variables and weights) for all variables, not just those with values differing from 0.Z"report_only_nonconverged_variableszKReport statistics (variables and weights) only for non-converged variables.Z#suppress_continuous_variable_outputz;Eliminate PH-related output involving continuous variables.zExtension OptionsZenable_ww_extensionsz0Enable the Watson-Woodruff PH extensions plugin.Zww_extension_cfgfilezNThe name of a configuration file for the Watson-Woodruff PH extensions plugin.Zww_extension_annotationfilezTThe name of a variable annotation file for the Watson-Woodruff PH extensions plugin.Zuser_defined_extensiona2The name of a python module specifying a user-defined PH extension plugin. Use this option when generating a template configuration file or invoking command-line help in order to include any plugin-specific options. This option can used multiple times from the command line to specify more than one plugin.Zsolution_writeraTThe name of a python module specifying a user-defined plugin invoked to write the scenario tree solution. Use this option when generating a template configuration file or invoking command-line help in order to include any plugin-specific options. This option can be used multiple times from the command line to specify more than one plugin.Zextension_precedencezSets the priority for execution of this extension relative to other extensions of the same type. Extensions with higher precedence values are guaranteed to be executed before any extensions having strictly lower precedence values. Default is 0.Z output_namezNThe directory or filename where the scenario tree solution should be saved to.Z input_namezQThe directory or filename where the scenario tree solution should be loaded from.Zsolution_saver_extensionaThe name of a python module specifying a user-defined plugin implementing the IPySPSolutionSaverExtension interface. Invoked to save a scenario tree solution. Use this option when generating a template configuration file or invoking command-line help in order to include any plugin-specific options. This option can be used multiple times from the command line to specify more than one plugin.Zsolution_loader_extensionaThe name of a python module specifying a user-defined plugin implementing the IPySPSolutionLoaderExtension interface. Invoked to load a scenario tree solution. Use this option when generating a template configuration file or invoking command-line help in order to include any plugin-specific options. This option can be used multiple times from the command line to specify more than one plugin.Z save_stageszThe number of scenario tree time stages to save from the solution. The default value of 0 indicates that all stages should be saved.Z load_stageszThe number of scenario tree stages to load from the solution. The default value of 0 indicates that all stages should be loaded.zAdvanced OptionsZ+pyro_transmit_leaf_stage_variable_solutionsaBy default, when running PH using the pyro scenario tree manager, leaf-stage variable solutions are not transmitted back to the master scenario tree during intermediate iterations. This flag will override that behavior for cases where leaf-stage variable solutions are required on the master scenario tree. Using this option can degrade runtime performance. When PH exits, variable values are collected from all stages whether or not this option was used. Also, note that PH extensions have the ability to override this flag at runtime.Zdisable_advanced_preprocessinga-Disable advanced preprocessing directives designed to speed up model I/O for scenario or bundle instances. This can be useful in debugging situations but will slow down algorithms that repeatedly solve subproblems. Use of this option will cause the '--preprocess-fixed-variables' option to be ignored.Zpreprocess_fixed_variablesa[Perform full preprocessing of instances after fixing or freeing variables in scenarios. By default, fixed variables will be included in the problem but 'fixed' by overriding their bounds. This increases the speed of Pyomo model I/O, but may be useful to disable in debugging situations or if numerical issues are encountered with certain solvers.Z(comparison_tolerance_for_fixed_variablesz Solve OptionsZmipgapzSpecifies the mipgap for all sub-problems (scenarios or bundles). The default value of None indicates not mipgap should be used.Zsolver_optionszPersistent solver options for all sub-problems (scenarios or bundles). This option can be used multiple times from the command line to specify more than one solver option.)r rZsolverZcplexzPSpecify the solver with which to solve scenarios (or bundles). Default is cplex.Z solver_iozThe type of IO used to execute the solver. Different solvers support different types of IO, but the following are common options: lp - generate LP files, nl - generate NL files, python - direct Python interface, os - generate OSiL XML files.Zsolver_managerz]The type of solver manager used to coordinate scenario sub-problem solves. Default is serial.Zdisable_warmstartz-Disable warm-start of all sub-problem solves.Zsolver_manager_pyro_hostz\The hostname to bind on when searching for a Pyro nameserver controlling the solver manager.Zsolver_manager_pyro_portzXThe port to bind on when searching for a Pyro nameserver controlling the solver_manager.Zsolver_manager_pyro_shutdownaAttempt to shut down all Pyro-related components associated with the Pyro name server for the solver manager. Components to shutdown include the name server, dispatch server, and any pyro_mip_server processes. Note that if Pyro4 is in use the nameserver will always ignore this request.z Other OptionsZ disable_gcz%Disable the python garbage collecter.Zprofile_memoryzIf Guppy or Pympler is available, report memory usage statistics for objects created by various PySP constructs. The default value of 0 disables memory profiling. Values greater than 0 indiciate increasing levels of verbosity.ZprofilezEnable profiling of Python code. The value of this option is the number of functions that are summarized. The default value of 0 disables profiling. tracebackzYWhen an exception is thrown, show the entire call stack. Ignored if profiling is enabled.Zcompile_scenario_instanceszoReplace all linear constraints on scenario instances with a more memory efficient sparse matrix representation.z;A collection of common deprecated PySP command-line optionszDeprecated Optionscs(eZdZdfdd ZdddZZS)_DeprecatedModelDirectoryNc s*|dk rtdtt|j||f|dS)Nznargs not allowed)rTr rr )r option_stringsdestnargskwargs)rrrr s z"_DeprecatedModelDirectory.__init__cCstdt|d|dS)NzDEPRECATED: The '--model-directory' command-line option has been deprecated and will be removed in the future. Please use --model-location instead.zCONFIGBLOCK.model_location)rRrSsetattr)r parser namespacevalues option_stringrrrrsz"_DeprecatedModelDirectory.__call__)N)N)rrrr rrrr)rrrsrcCstjdt|S)Nz WARNING: The 'model_directory' config item will be ignored unless it is being used as a command-line option where it can be redirected to 'model_location'. Please use 'model_location' instead. )sysstderrr=r)r{rrr_warn_model_directorysrZmodel_directoryz%Deprecated alias for --model-location)z--model-directorycs(eZdZdfdd ZdddZZS)_DeprecatedInstanceDirectoryNc s*|dk rtdtt|j||f|dS)Nznargs not allowed)rTr rr )r rrrr)rrrr s z%_DeprecatedInstanceDirectory.__init__cCst|d|dS)Nz"CONFIGBLOCK.scenario_tree_location)r)r rrrrrrrr sz%_DeprecatedInstanceDirectory.__call__)N)N)rrrr rrrr)rrrsrcCstjdt|S)Nz WARNING: The 'instance_directory' config item will be ignored unless it is being used as a command-line option where it can be redirected to 'scenario_tree_location'. Please use 'scenario_tree_location' instead. )rrr=r)r{rrr_warn_instance_directorysrZinstance_directoryz1Deprecated alias for --scenario-tree-location, -s)z-iz--instance-directorycs(eZdZdfdd ZdddZZS)_DeprecatedHandshakeWithPHPyroNc s2|dk rtdtt|j||fddi|dS)Nznargs not allowedrr)rTr rr )r rrrr)rrrr 5s z'_DeprecatedHandshakeWithPHPyro.__init__cCstdt|dddS)NzDEPRECATED: The '--handshake-with-phpyro command-line option has been deprecated and will be removed in the future. Please use '--pyro-handshake-at-startup instead.z%CONFIGBLOCK.pyro_handshake_at_startupT)rRrSr)r rrrrrrrr:sz'_DeprecatedHandshakeWithPHPyro.__call__)N)N)rrrr rrrr)rrr4srcCstjdt|S)Nz WARNING: The 'handshake_with_phpyro' config item will be ignored unless it is being used as a command-line option where it can be redirected to 'pyro_handshake_at_startup'. Please use 'pyro_handshake_at_startup' instead. )rrr=bool)r{rrr_warn_handshake_with_phpyroAsrZhandshake_with_phpyroz0Deprecated alias for --pyro-handshake-at-startupcs(eZdZdfdd ZdddZZS) _DeprecatedPHPyroRequiredWorkersNc s*|dk rtdtt|j||f|dS)Nznargs not allowed)rTr rr )r rrrr)rrrr as z)_DeprecatedPHPyroRequiredWorkers.__init__cCstdt|d|dS)NzDEPRECATED: The '--phpyro-required-workers command-line option has been deprecated and will be removed in the future. Please use '--pyro-required-scenariotreeservers instead.z-CONFIGBLOCK.pyro_required_scenariotreeservers)rRrSr)r rrrrrrrrfsz)_DeprecatedPHPyroRequiredWorkers.__call__)N)N)rrrr rrrr)rrr`srcCstjdt|S)Nz WARNING: The 'phpyro_required_workers' config item will be ignored unless it is being used as a command-line option where it can be redirected to 'pyro_required_scenariotreeservers'. Please use 'pyro_required_scenariotreeservers' instead. )rrr=r)r{rrr_warn_phpyro_required_workersmsrZphpyro_required_workersz8Deprecated alias for --pyro-required-scenariotreeserverscs(eZdZdfdd ZdddZZS)_DeprecatedPHPyroWorkersTimeoutNc s*|dk rtdtt|j||f|dS)Nznargs not allowed)rTr rr )r rrrr)rrrr s z(_DeprecatedPHPyroWorkersTimeout.__init__cCstdt|d|dS)NzDEPRECATED: The '--phpyro-workers-timeout command-line option has been deprecated and will be removed in the future. Please use '--pyro-find-scenariotreeservers-timeout instead.z1CONFIGBLOCK.pyro_find_scenariotreeservers_timeout)rRrSr)r rrrrrrrrsz(_DeprecatedPHPyroWorkersTimeout.__call__)N)N)rrrr rrrr)rrrsrcCstjdt|S)Nz WARNING: The 'phpyro_workers_timeout' config item will be ignored unless it is being used as a command-line option where it can be redirected to 'pyro_find_scenariotreeservers_timeout'. Please use 'pyro_find_scenariotreeservers_timeout' instead. )rrr=rz)r{rrr_warn_phpyro_workers_timeoutsrZphpyro_workers_timeoutzt|jdksLt|jdksZt|dk r|j dk rtt d|t krt d||}|t krt d||kr )TTTT)NFFNN)NFNNF)NNN)NN)N)h__all__rrkloggingr,Zpyomo.common.configrrZpyomo.core.baserrargparserf getLoggerrRrrrdrrrxryrr|rr~rrobjectrrrrrrZ_input_options_group_titlerrZ"_scenario_tree_options_group_titlerZ_pyro_options_group_titlerrzZ_output_options_group_titleZ_ph_options_group_titlerrrZ_extension_options_group_titleZ_advanced_options_group_titleZ_solve_options_group_titleZ_other_options_group_titlertruZ_deprecated_options_group_titleActionrrr'rrrrrrrrrrrrrrrrrrrrrrrrrrZ pyomo.environZpyomorrblockrrjArgumentParserZapZinitialize_argparseZimport_argparse parse_argsr<rrrZ user_valuesrPr2rrrrrs # < 7 8                        =H