CustomSelection creates multiple copies of my submodular function method
itskalvik opened this issue · comments
Hi, I have a submodular function that is implemented as a python class. My class has a method that is passed to a CustomSelection object as follows
subfn= CustomSubmodular(arg1, arg2, ...)
model = CustomSelection(5, subfn.submodular_function)
But when I optimize this model, it creates new instances of my CustomSubmodular class instead of using the provided instance. Is there a way around this? I suppose I can use the function_kwds parameter of CustomSelection to make a submodular function that is not defined as a class, but I would like to avoid it if possible.
The problem was my class was using joblib to parallelize a task and it was making a copy of my class instance, not apricot.