Saving and Restoring Model Snapshots via API

Saving / restoring model snapshot from all experiments except for the custom experiment

You can save and restore model snaphots using API functions which both take one parameter – the name of the snapshot file. Call them as follows:

Saving / restoring model snapshot from custom experiment

You can also save and restore model snapshots from custom experiment code using the following functions of Engine:

Examples:

When you create a custom experiment, the experiment has default auto-generated code (see the custom experiment's properties, Code section) containing this line of code: Engine engine = createEngine();

This code creates engine and stores it in the local variable engine. Use it to call the functions mentioned above. To call the functions, write the following code:

engine.saveRootObjectSnapshot("C:\Model\Model.als");

Main root = (Main)engine.loadRootObjectSnapshot("C:\Model\Model.als");

Or, instead of typing the code, you can automatically insert the load snapshot function call while creating a custom experiment, by selecting the checkbox Load top-level agent from snapshot on the second page of the New Experiment wizard.