util

Utility functions for the PyROS solver

Enums

ObjectiveType(value)

SeparationStrategy(value)

SolveMethod(value)

pyrosTerminationCondition(value)

Enumeration of all possible PyROS termination conditions.

Classes

BoundTriple(lower, eq, upper)

BoundType()

Indicator for whether a bound on a variable/constraint is a lower bound, "equality" bound, or upper bound.

IterationLogRecord(iteration, objective, ...)

PyROS solver iteration log record.

ModelData(original_model, config, timing)

Container for modeling objects from which the PyROS subproblems are constructed.

PreformattedLogger(name[, level])

A specialized logger object designed to cast log messages to Pyomo Preformatted objects prior to logging the messages.

TimingData()

PyROS solver timing data object.

VariablePartitioning(first_stage_variables, ...)

Functions

add_decision_rule_constraints(model_data)

Add decision rule equality constraints to the working model.

add_decision_rule_variables(model_data)

Add variables parameterizing the (polynomial) decision rules to the working model.

add_effective_var_partitioning(model_data)

Obtain a repartitioning of the in-scope variables of the working model according to known adjustability to the uncertain parameters, and add this repartitioning to the working model.

adjust_solver_time_settings(timing_data_obj, ...)

Adjust maximum time allowed for subordinate solver, based on total PyROS solver elapsed time up to this point.

call_solver(model, solver, config, ...)

Solve a model with a given optimizer, keeping track of wall time requirements.

check_components_descended_from_model(model, ...)

Check all members in a provided sequence of Pyomo component objects are descended from a given ConcreteModel object.

check_time_limit_reached(timing_data, config)

Return true if the PyROS solver time limit is reached, False otherwise.

check_variables_continuous(model, vars, config)

Check that all DOF and state variables of the model are continuous.

copy_docstring(source_func)

Create a decorator which copies docstring of a callable source_func to a target callable passed to the decorator.

create_bound_constraint_expr(expr, bound, ...)

Create a relational expression establishing a bound for a numeric expression of interest.

declare_objective_expressions(working_model, ...)

Identify the per-stage summands of an objective of interest, according to the user-based variable partitioning.

determine_certain_and_uncertain_bound(...)

Determine the certain and uncertain lower or upper bound for a variable object, based on the specified domain and declared bound.

enforce_dr_degree(working_blk, config, degree)

Make decision rule polynomials of a given degree by fixing value of the appropriate subset of the decision rule coefficients to 0.

generate_all_decision_rule_eqns(working_blk)

Generate sequence of all decision rule equations.

generate_all_decision_rule_var_data_objects(...)

Generate a sequence of all decision rule variable data objects.

get_all_adjustable_variables(working_model)

Get all variables considered adjustable.

get_all_nonadjustable_variables(working_model)

Get all nonadjustable variables of the working model.

get_dr_expression(working_blk, second_stage_var)

Get DR expression corresponding to given second-stage variable.

get_dr_var_to_monomial_map(working_blk)

Get mapping from all decision rule variables in the working block to their corresponding DR equation monomials.

get_effective_var_partitioning(model_data)

Partition the in-scope variables of the input model according to known nonadjustability to the uncertain parameters.

get_main_elapsed_time(timing_data_obj)

Returns the time since entering the main time_code context

get_summands(expr)

Recursively gather the individual summands of a numeric expression.

get_var_bound_pairs(var)

Get the domain and declared lower/upper bound pairs of a variable data object.

get_var_certain_uncertain_bounds(var, ...)

Determine the certain and uncertain lower/equality/upper bound triples for a variable data object, based on that variable's domain and declared bounds.

load_final_solution(model_data, master_soln, ...)

Load variable values from the master problem to the original model.

log_model_statistics(model_data)

Log statistics for the preprocessed model.

preprocess_model_data(model_data, ...)

Preprocess user inputs to modeling objects from which PyROS subproblems can be efficiently constructed.

rearrange_bound_pair_to_triple(lower_bound, ...)

Rearrange a lower/upper bound pair into a lower/equality/upper bound triple, according to whether or not the lower and upper bound are identical numerical values or expressions.

reformulate_state_var_independent_eq_cons(...)

Reformulate second-stage equality constraints that are independent of the state variables.

remove_all_var_bounds(var)

Remove all the domain and declared bounds for a specified variable data object.

remove_var_declared_bound(var, bound_type)

Remove the specified declared bound(s) of a variable data object.

replace_vars_with_params(block, var_to_param_map)

Substitute ParamData objects for VarData objects in the Expression, Constraint, and Objective components declared on a block and all its sub-blocks.

revert_solver_max_time_adjustment(solver, ...)

Revert solver options attribute to its state prior to a time limit adjustment performed via the routine adjust_solver_time_settings.

setup_pyros_logger([name])

Set up pyros logger.

setup_quadratic_expression_visitor(wrt[, ...])

Setup a parameterized quadratic expression walker.

setup_working_model(model_data, ...)

Set up (construct) the working model based on user inputs, and add it to the model data object.

standardize_active_objective(model_data)

Standardize the active objective of the working model.

standardize_component_data(obj, valid_ctype, ...)

Cast an object to a list of Pyomo ComponentData objects.

standardize_equality_constraints(model_data)

Classify the original active equality constraints of the working model as first-stage or second-stage constraints.

standardize_inequality_constraints(model_data)

Standardize the inequality constraints of the working model, and classify them as first-stage inequalities or second-stage inequalities.

time_code(timing_data_obj, code_block_name)

Starts timer at entry, stores elapsed time at exit.

turn_adjustable_var_bounds_to_constraints(...)

Reformulate domain and declared bounds for the adjustable (i.e., effective second-stage and effective state) variables of the working model to explicit constraints.

turn_nonadjustable_var_bounds_to_constraints(...)

Reformulate uncertain bounds for the nonadjustable (i.e. effective first-stage) variables of the working model to constraints.

validate_model(model, config)

Validate deterministic model passed to PyROS solver.

validate_pyros_inputs(model, config)

Perform advanced validation of PyROS solver arguments.

validate_separation_problem_options(model, ...)

Validate separation problem arguments to the PyROS solver.

validate_uncertainty_specification(model, config)

Validate specification of uncertain parameters and uncertainty set.

validate_variable_partitioning(model, config)

Check that the partitioning of the in-scope variables of the model is valid.