Cache

Cache Saving and Loading

The evaluated costs during the optimization process are stored in the cache as a dictionary with the poll point as the key, and its evaluted cost as the value. The cache may be saved in a file after running the optimization, and can then be pre-loaded in order to reduce the number of function evaluations in a future run.

Two formats are currently supported: JSON and JLD2.

JSON

The advantage of JSON is that it is human readable, and is also language-independent, so it can be generated by programs in other languages. However, it scales poorly with larger problem dimensionalities, and a large number of points, in terms of memory, saving and loading time. A truncated example of the costs stored in JSON format is given below:

{
    "[5.0, 2.5, 0.15]": 12.110706,
    "[4.0, 1.5, 0.15]": 9.920012,
    "[3.79, 26.3, 0.4]": 3.10409,
    ...
}

JLD2

JLD2 is a file format used to save Julia variables with their type information. It is provided by the JLD2.jl package. The advantage of JLD2 is that stores variables with their Julia type information, and scales significantly better with larger dictionaries than JSON. It is recommended option when using with problems of large dimensionalities (more than 100 variables).

Functions

The saving and loading of the evaluated costs is provided by the function CacheLoadJSON, CacheSaveJSON, CacheLoadJLD2, and CacheSaveJLD2.