Repository navigation
Unopy 0.4.15 changed options, now causes failures with pyoptsparse #500
Description
Description
pyUNO registers loose_primal_tolerance, loose_dual_tolerance and loose_tolerance_iteration_threshold as default options. Uno removed these options in v2.9.1 (unopy 0.4.15), replacing them with an "acceptable termination" scheme.
Because pyOptSparse passes every option, including untouched defaults, to solver.set_option, any use of the Uno optimizer with unopy 0.4.15 or newer fails, even if the user never sets these options.
I think pyoptsparse should limit the default options listed for Uno to a small, stable set and leave the rest to Uno's own defaults and presets.
Steps to reproduce issue
- Install pyOptSparse 2.16.0 and unopy 0.4.15 (Uno 2.9.1).
- Run any optimization with
OPT("Uno"), for example the pyOptSparse tutorial problem, or an OpenMDAOpyOptSparseDriverwithoptimizer='Uno'. - Observe that the optimizer fails when options are applied, before the first iteration.
Minimal check of the underlying cause:
import unopy
s = unopy.UnoSolver()
s.set_option('primal_tolerance', 1e-8) # OK
s.set_option('loose_primal_tolerance', 1e-6) # KeyError: 'loose_primal_tolerance does not exist'I applied each of the 20 defaults registered in pyUNO.py to unopy 0.4.15. The only rejected ones are the three loose_* options. save_major_iteration_variables is a Python-side option and is not forwarded to set_option.
Current behavior
pyUNO.py defines these defaults (around line 134):
"loose_primal_tolerance": [float, 1e-6],
"loose_dual_tolerance": [float, 1e-6],
"loose_tolerance_iteration_threshold": [int, 15],and then calls solver.set_option(name, value) for every option not in pythonOptions (around line 458). With unopy >= 0.4.15 this raises KeyError: 'loose_primal_tolerance does not exist'.
Other option changes between Uno v2.9.0 and v2.9.1:
| Option (v2.9.0) | Status in v2.9.1 | set_option in unopy 0.4.15 |
|---|---|---|
loose_primal_tolerance, loose_dual_tolerance, loose_tolerance_iteration_threshold |
removed; replaced by acceptable_* and tight_unscaled_* options (#974) |
rejected |
switching_objective_exponent |
renamed to switching_merit_exponent |
old name rejected, new name accepted |
filter_type |
removed (only standard existed) |
rejected |
funnel_switching_infeasibility_exponent |
removed; the funnel preset now uses switching_infeasibility_exponent |
rejected |
switch_to_optimality_requires_acceptance |
removed | rejected |
hessian_model (default exact), inertia_correction_strategy (default primal) |
no longer set in DefaultOptions.cpp |
still accepted |
New options in v2.9.1:
tight_unscaled_{stationarity,primal_infeasibility,complementarity}_toleranceacceptable_toleranceacceptable_unscaled_{stationarity,primal_infeasibility,complementarity}_toleranceacceptable_objective_change_toleranceacceptable_iteration_thresholdbound_multiplier_max_normbound_relaxation_factorconstraint_violation_tolerancefilter_margin_uses_entry_infeasibilityfunction_scaling_lower_boundprint_extended_statisticsprint_minor_iterationsregularize_all_variablesuse_proximal_term
The presets also changed (for example ipopt now sets use_proximal_term and regularize_all_variables), so preset behaviour is not identical across these versions either.
pyOptSparse only registers the three loose_* options among the removed ones, so only they break the wrapper today. A user who passes filter_type, switching_objective_exponent and similar options through OPT("Uno", options=...) will hit the same KeyError.
Expected behavior
OPT("Uno") should work with the current release of unopy. Ideally the wrapper should not break on upstream option renames or removals.
Code versions
- Operating System: macOS 26.7.1 (arm64)
- Python: 3.11.15
- OpenMPI: N/A
- CGNS: N/A
- PETSc: N/A
- Compiler: N/A (unopy installed as a prebuilt wheel)
- unopy: 0.4.15 (Uno 2.9.1) fails; 0.4.14 (Uno 2.9.0) and earlier work
- This repository: pyOptSparse 2.16.0
Activity