save_state#

TwinModel.save_state()#

Save the state of the twin model after its initialization and after step-by-step evaluation.

This method should be used in conjunction with the pytwin.TwinModel.load_state() method.

Examples

>>> from pytwin import TwinModel
>>> # Instantiate a twin model, initialize it, and evaluate it step by step until you want to save its state
>>> model1 = TwinModel('model.twin')
>>> model1.initialize_evaluation()
>>> model1.evaluate_step_by_step(step_size=0.1)
>>> model1.save_state()
>>> # Instantiate a new twin model with the same TWIN file and load the saved state
>>> model2 = TwinModel('model.twin')
>>> model2.load_state(model_id=model1.id, evaluation_time=model1.evaluation_time)
>>> model2.evaluate_step_by_step(step_size=0.1)