umx_set_optimizer: Set the optimizer in OpenMx

umx_set_optimizerR Documentation

Set the optimizer in OpenMx

Description

umx_set_optimizer provides an easy way to get and set the default optimizer. umx can use several optimizers: SLSQP (the default), CSOLNP, or NPSOL. SLSQP is often a good choice. CSOLNPoften works well for ordinal models. NPSOL is proprietary. It is not in the CRAN version of OpenMx. However it can outperform other optimizers, esp. on CIs.

Usage

umx_set_optimizer(opt = NA, model = NULL, silent = FALSE)

Arguments

opt

default (NA) returns current value. Current alternatives are "NPSOL" "SLSQP" and "CSOLNP".

model

A model for which to set the optimizer. Default (NULL) sets the optimizer globally.

silent

If TRUE, no message will be printed.

Details

A bare call simply shows the current optimizer:

umx_set_optimizer()
> Current Optimizer is: 'SLSQP'. Options are: 'CSOLNP', 'SLSQP', and 'NPSOL'

Set the optimizer by name. note: the old optimizer is returned, so you can stash it:

oldOpt = umx_set_optimizer("CSOLNP")
# ...
umx_set_optimizer(oldOpt)

Value

  • current optimizer if nothing requested to be set.

References

https://tbates.github.io, https://github.com/tbates/umx

See Also

Other Get and set: umx, umx_detect_cores(), umx_get_checkpoint(), umx_get_options(), umx_scale_reliabilities(), umx_set_auto_plot(), umx_set_auto_run(), umx_set_checkpoint(), umx_set_condensed_slots(), umx_set_cores(), umx_set_data_variance_check(), umx_set_dollar_symbol(), umx_set_optimization_options(), umx_set_plot_file_suffix(), umx_set_plot_format(), umx_set_separator(), umx_set_silent(), umx_set_table_format()

Examples

library(umx)
umx_set_optimizer() # print the existing state
old = umx_set_optimizer(silent = TRUE) # store the existing state
umx_set_optimizer("SLSQP") # update globally
umx_set_optimizer(old) # set back

umx documentation built on Oct. 11, 2026, 5:07 p.m.