Update handlers to save the descent run to a file. The existing handlers
in data will be kept, but additional logic will be added to them
that saves all data computed during the descent run to a file. This
file can then be used with so_replay_descent
.
file can either be a file ID (integer) or file name (string).
In the latter case, the file will be created in "wb"
mode
and closed after the descent run. header should be some data
(possibly a struct) that will be written as the “file header”.
It can contain data that identifies the problem solved and all
parameter values. It must be possible to reproduce a problem’s data
structure from this header when replaying the descent.
The state struct can be optionally “compressed” before it is written,
in case it contains excessive amounts of data that is not necessary
for the replay (for instance, because it is cheap to re-compute).
If this feature should be used, a function must be defined that translates
the state struct accordingly. It should be stored in
data.compress.save.state
, and will be called
with arguments (s, data)
. It should return
the state struct in the form to save it.
This routine requires fsave
from the parallel
package
to be available. Note that the files are not guaranteed to be interoperable
between machines or package versions.
See also: so_run_descent, so_replay_descent, so_explore_descent, fsave.
Package: level-set