coin-or / rbfopt

RBFOpt library for black-box optimization
Other
188 stars 33 forks source link

Using dill instead of pickle if possible #25

Closed KOLANICH closed 5 years ago

KOLANICH commented 5 years ago

dill can serialize more types than pickle, pickle just fails with errors in these cases.

gnannicini commented 5 years ago

Does this pass the standard test suite?

KOLANICH commented 5 years ago

I have not tested that.

gnannicini commented 5 years ago

Ok, I will have a look.

gnannicini commented 5 years ago

I tried it and it works, however I fail to see the advantage. Pickle currently is used only to save and load the state of the algorithm from file. All data types used in rbfopt can be pickled with the pickle module already, and save/load seems to work correctly. What is the benefit of using dill instead? (It requires an extra package, so I'd like to understand in detail)

KOLANICH commented 5 years ago

All data types used in rbfopt

I have expetienced some exceptions when optimizing functions which are created inside of functions (though in my case even dill haven't helped because these functions used objects that cannot be serialized).

gnannicini commented 5 years ago

Did you get exceptions when using the parallel optimization (num_cpus > 1), or when saving/loading the state from file? That "pickle" import is only used to save/load the state from file, it has no consequence on the parallel optimization.

KOLANICH commented 5 years ago

When saving/loading from file (though I don't need it, I have an own system for it).