Skip to content
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
53bbc30
Move bounds calculation to separate, cached method
jas-yao Mar 20, 2026
b6a03aa
Clear any cached bounds at set validation
jas-yao Mar 20, 2026
65e9564
Add tests checking caching.
jas-yao Mar 20, 2026
a483ab6
Fix _fbbt_parameter_bounds bound value issues
jas-yao Mar 20, 2026
549d5b8
Run black
jas-yao Mar 20, 2026
bb7fca5
Fix test comments
jas-yao Mar 20, 2026
a6ef4f5
Merge branch 'main' into pyros-cache-computed-param-bounds
jas-yao Mar 22, 2026
3a955f6
Update _solve_bounds_optimization docstring
jas-yao Mar 26, 2026
d003145
Merge branch 'main' into pyros-cache-computed-param-bounds
jsiirola Apr 2, 2026
c573512
Merge branch 'main' into pyros-cache-computed-param-bounds
jas-yao May 6, 2026
f0e86b6
Update bounds optimization caching
jas-yao May 6, 2026
2af61c8
Add test_solve_exact_bounds_optimization
jas-yao May 6, 2026
bb53c9d
Add test_fbbt_values
jas-yao May 6, 2026
be21c04
Move cache clearing to before/after solving
jas-yao May 6, 2026
7619f3e
Add tests for PyROS caching
jas-yao May 6, 2026
81a98ab
Run black
jas-yao May 6, 2026
4f78486
Run updated black
jas-yao May 6, 2026
581a9f7
Update CHANGELOG
jas-yao May 6, 2026
7aeeef5
Merge branch 'main' into pyros-cache-computed-param-bounds
jsiirola May 8, 2026
6de83b7
Merge branch 'main' into pyros-cache-computed-param-bounds
jas-yao May 11, 2026
31e96fd
Update caching with custom dict
jas-yao May 11, 2026
43f09d8
Simplify cache clearing setup
jas-yao May 11, 2026
ee87245
Update caching tests
jas-yao May 11, 2026
c1145cd
Run black
jas-yao May 11, 2026
d905ab4
Merge branch 'main' into pyros-cache-computed-param-bounds
jas-yao May 12, 2026
5518ee8
Use `var.lb` and `var.ub` for numerical bounds
jas-yao May 12, 2026
d954aba
Add assertion check for empty _cache
jas-yao May 12, 2026
c242b6a
Update caching tests for assertion error test
jas-yao May 12, 2026
e0863b0
Run black
jas-yao May 12, 2026
4ebca37
Merge branch 'main' into pyros-cache-computed-param-bounds
jsiirola May 14, 2026
6259595
Merge branch 'main' into pyros-cache-computed-param-bounds
jas-yao May 15, 2026
43079be
Apply suggestion from @shermanjasonaf
jas-yao May 15, 2026
32b278b
Apply descriptive TestPyROSCacheUncertaintySetBounds name and docstring
jas-yao May 15, 2026
15c0218
Update caching unit tests.
jas-yao May 15, 2026
d12f066
Merge branch 'main' into pyros-cache-computed-param-bounds
jas-yao May 15, 2026
acecc15
Update CHANGELOG
jas-yao May 15, 2026
60d2491
Update uncertainty set caching documentation
jas-yao May 15, 2026
f55f97c
Run black
jas-yao May 15, 2026
c152970
Update uncertaintyset cache manager design to support CartesianProduc…
jsiirola May 15, 2026
1632ba1
NFC: fix typo
jsiirola May 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyomo/contrib/pyros/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ PyROS CHANGELOG
===============


-------------------------------------------------------------------------------
PyROS 1.3.14 20 Mar 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After PR #3951 is either merged or closed, you may update the PyROS version number (in pyros.py) and further update the changelog here according to this comment. In particular, if #3951 is closed rather than merged, then the final version number here will be 1.3.14.

-------------------------------------------------------------------------------
- Add caching for uncertainty set parameter bounds


-------------------------------------------------------------------------------
PyROS 1.3.13 16 Jan 2026
-------------------------------------------------------------------------------
Expand Down
156 changes: 85 additions & 71 deletions pyomo/contrib/pyros/pyros.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,83 +418,97 @@ def solve(
self._log_intro(logger=progress_logger, level=logging.INFO)
self._log_disclaimer(logger=progress_logger, level=logging.INFO)

config, user_var_partitioning = self._resolve_and_validate_pyros_args(
model, **kwds
)
self._log_config_user_values(
logger=config.progress_logger,
config=config,
exclude_options=(
self._DEFAULT_CONFIG_USER_OPTIONS
+ ["nominal_uncertain_param_vals"]
* (not nominal_param_vals_in_kwds)
),
level=logging.INFO,
)
self._log_config(
logger=config.progress_logger,
config=config,
exclude_options=None,
level=logging.DEBUG,
)
model_data.config = config

log_original_model_statistics(model_data, user_var_partitioning)
IterationLogRecord.log_header_rule(config.progress_logger.info)
config.progress_logger.info("Preprocessing...")
model_data.timing.start_timer("main.preprocessing")
robust_infeasible = model_data.preprocess(user_var_partitioning)
model_data.timing.stop_timer("main.preprocessing")
preprocessing_time = model_data.timing.get_total_time("main.preprocessing")
config.progress_logger.info(
f"Done preprocessing; required wall time of "
f"{preprocessing_time:.3f}s."
)

IterationLogRecord.log_header_rule(config.progress_logger.debug)
log_preprocessed_model_statistics(model_data)
# clear cache before validation
if hasattr(uncertainty_set, "_cache"):
uncertainty_set._cache.clear()

# try solving and clear any cached values to free memory
try:
config, user_var_partitioning = self._resolve_and_validate_pyros_args(
model, **kwds
)
self._log_config_user_values(
logger=config.progress_logger,
config=config,
exclude_options=(
self._DEFAULT_CONFIG_USER_OPTIONS
+ ["nominal_uncertain_param_vals"]
* (not nominal_param_vals_in_kwds)
),
level=logging.INFO,
)
self._log_config(
logger=config.progress_logger,
config=config,
exclude_options=None,
level=logging.DEBUG,
)
model_data.config = config

# === Solve and load solution into model
return_soln = ROSolveResults()
if not robust_infeasible:
pyros_soln = ROSolver_iterative_solve(model_data)
log_original_model_statistics(model_data, user_var_partitioning)
IterationLogRecord.log_header_rule(config.progress_logger.info)
config.progress_logger.info("Preprocessing...")
model_data.timing.start_timer("main.preprocessing")
robust_infeasible = model_data.preprocess(user_var_partitioning)
model_data.timing.stop_timer("main.preprocessing")
preprocessing_time = model_data.timing.get_total_time(
"main.preprocessing"
)
config.progress_logger.info(
f"Done preprocessing; required wall time of "
f"{preprocessing_time:.3f}s."
)

termination_acceptable = pyros_soln.pyros_termination_condition in {
pyrosTerminationCondition.robust_optimal,
pyrosTerminationCondition.robust_feasible,
}
if termination_acceptable:
load_final_solution(
model_data=model_data,
master_soln=pyros_soln.master_results,
original_user_var_partitioning=user_var_partitioning,
IterationLogRecord.log_header_rule(config.progress_logger.debug)
log_preprocessed_model_statistics(model_data)

# === Solve and load solution into model
return_soln = ROSolveResults()
if not robust_infeasible:
pyros_soln = ROSolver_iterative_solve(model_data)
IterationLogRecord.log_header_rule(config.progress_logger.info)

termination_acceptable = pyros_soln.pyros_termination_condition in {
pyrosTerminationCondition.robust_optimal,
pyrosTerminationCondition.robust_feasible,
}
if termination_acceptable:
load_final_solution(
model_data=model_data,
master_soln=pyros_soln.master_results,
original_user_var_partitioning=user_var_partitioning,
)

# get the most recent master objective, if available
return_soln.final_objective_value = None
master_epigraph_obj_value = value(
pyros_soln.master_results.master_model.epigraph_obj,
exception=False,
)

# get the most recent master objective, if available
return_soln.final_objective_value = None
master_epigraph_obj_value = value(
pyros_soln.master_results.master_model.epigraph_obj, exception=False
)
if master_epigraph_obj_value is not None:
# account for sense of the original model objective
# when reporting the final PyROS (master) objective,
# since maximization objective is changed to
# minimization objective during preprocessing
return_soln.final_objective_value = (
model_data.active_obj_original_sense * master_epigraph_obj_value
if master_epigraph_obj_value is not None:
# account for sense of the original model objective
# when reporting the final PyROS (master) objective,
# since maximization objective is changed to
# minimization objective during preprocessing
return_soln.final_objective_value = (
model_data.active_obj_original_sense
* master_epigraph_obj_value
)

return_soln.pyros_termination_condition = (
pyros_soln.pyros_termination_condition
)
return_soln.iterations = pyros_soln.iterations
else:
return_soln.final_objective_value = None
return_soln.pyros_termination_condition = (
pyrosTerminationCondition.robust_infeasible
)
return_soln.iterations = 0

return_soln.pyros_termination_condition = (
pyros_soln.pyros_termination_condition
)
return_soln.iterations = pyros_soln.iterations
else:
return_soln.final_objective_value = None
return_soln.pyros_termination_condition = (
pyrosTerminationCondition.robust_infeasible
)
return_soln.iterations = 0
finally:
if hasattr(uncertainty_set, "_cache"):
uncertainty_set._cache.clear()

return_soln.config = config
return_soln.time = model_data.timing.get_total_time("main")
Expand Down
Loading
Loading