Initialize From Data

Initialize From Data#

This Initializer is intended to initialize a model from a user defined data source. This data source may take the form of a pre-saved json file or a user provided dict-like data structure. This Initializer loads variable values from the data provided and checks that the resulting values satisfy all constraints in the model.

Note

When initializing from a json format, only the values of unfixed variables will be loaded. Any other information stored in the json format (e.g., whether a variable is fixed or any information regarding constraints) will be ignored.

FromDataInitializer Class#

class idaes.core.initialization.initialize_from_data.FromDataInitializer(**kwargs)[source]#

This is a general purpose Initializer object which attempts to initialize a model from user provided data.

Data can be provided in either json format or as a dict-like structure. The loaded solution is then checked to ensure that it satisfies all constraints in the model.

constraint_tolerance

Tolerance for checking constraint convergence

output_level

Set output level for logging messages

initialize(model, initial_guesses=None, json_file=None, output_level=None, exclude_unused_vars=False)#

Execute full initialization routine.

Parameters:
  • model (Block) – Pyomo model to be initialized.

  • initial_guesses (dict) – dict of initial guesses to load.

  • json_file (str) – file name of json file to load initial guesses from as str.

  • output_level – (optional) output level to use during initialization run (overrides global setting).

  • exclude_unused_vars (bool) – whether to ignore unused variables when doing post-initialization checks.

Note - can only provide one of initial_guesses or json_file.

Returns:

InitializationStatus Enum

Parameters:
  • model (Block) –

  • initial_guesses (dict) –

  • json_file (str) –

  • exclude_unused_vars (bool) –

precheck(model)#

Check for satisfied degrees of freedom before running initialization.

Parameters:

model (Block) – Pyomo Block to fix states on.

Returns:

None

Raises:

InitializationError if Degrees of Freedom do not equal 0.