save_state#
- TwinModel.save_state()#
Save the state of a TwinModel. This method will save the state of the twin model after its initialization and/or step by step evaluation.
It should be used in conjunction with the load_state method.
Examples
>>> from pytwin import TwinModel >>> # Instantiate a TwinModel, 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 TwinModel with 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)