Solvers¶
This section provides information on using and configuring solvers for IDAES. Some IDAES solver features are documented in other sections, so references are provided as appropriate. In general, standard Pyomo solver interfaces and features can be used in IDAES, but IDAES provides a few extensions to make working with solvers slightly easier.
Default Solver Config¶
The default solver settings can be set via the IDAES IDAES configuration system. By
default the solver settings are not taken from the IDAES configuration system
to avoid confusion where IDAES defaults differ from Pyomo defaults. To use the
IDAES solver defaults a user must explicitly enable them with the
use_idaes_solver_configuration_defaults()
function.
- idaes.core.solvers.config.use_idaes_solver_configuration_defaults(b=True)[source]¶
This function enables (or disables if given False as the argument) solvers getting default settings from the IDAES configuration. When enabled this allows global configuration of solvers.
- Parameters
b – True to use default solver configurations from the IDAES configuration False to use standard Pyomo solver factories. Default is True.
- Returns
None
Getting a Solver¶
A utility function (idaes.core.util.misc.get_solver
) provides
functionality to get a default or user specified solver at run time. This is
usually used by IDAES core models and tests. If no solver is specified the
IDAES default (usually Ipopt) is used. This is handy for method such as problem
initialization, where a default solver and options is usually used, but a user
can also choose a different solver or different options.
Solver Logging¶
A logger for solver-related log messages can be obtained from the IDAES logging system.
IDAES has features for redirecting solver output to a log. This is documented in the logging section.
Solver Feature Checking¶
There are some functions available to check what features are available to solvers and to help with basic solver testing.
- idaes.core.solvers.ipopt_has_linear_solver(linear_solver)[source]¶
Check if IPOPT can use the specified linear solver.
- Parameters
linear_solver (str) – linear solver in {“ma27”, “ma57”, “ma77”, “ma86”, “ma97”, “pardiso”, “pardisomkl”, “spral”, “wsmp”, “mumps”} or other custom solver.
- Returns
- True if Ipopt is available with the specified linear solver or False
if either Ipopt or the linear solver is not available.
- Return type
(bool)
Test Models¶
The idaes.core.solvers.features
provides functions to return simple models
of various types. These models can be used to test if solvers are available and
functioning properly. They can also be used to test that various option solver
features are available. These functions all return a tuple where the first
element is a model of the specified type, and the second element is the correct
value for the x variable after the problem is solved.
- idaes.core.solvers.features.lp()[source]¶
This provides a simple LP model for solver testing.
- Parameters
None –
- Returns
Pyomo ConcreteModel, correct solved value for m.x
- Return type
(tuple)
- idaes.core.solvers.features.milp()[source]¶
This provides a simple MILP model for solver testing.
- Parameters
None –
- Returns
Pyomo ConcreteModel, correct solved value for m.x
- Return type
(tuple)