convexengineering / gpkit

Geometric programming for engineers
http://gpkit.readthedocs.org
MIT License
206 stars 40 forks source link

Unable to pickle solutions with lambda functions #1470

Closed pgk-vho closed 4 years ago

pgk-vho commented 4 years ago

As of 367a46dd78d4369b286784687c98e1314d064f08, I get an error trying to use sol.save()

--> 520     sol.save("fixedmass.p")

~/Documents/Optimization/gpkit/gpkit/solution_array.py in save(self, filename)
    422         """
    423         program, model, cost, warnings = self.pickle_prep()
--> 424         pickle.dump(self, open(filename, "wb"), protocol=1)
    425         self["cost"], self["warnings"] = cost, warnings
    426         self.program, self.model = program, model

AttributeError: Can't pickle local object 'setup.<locals>.<lambda>'

Per this issue, might need to use dill instead?

bqpd commented 4 years ago

Hmm, I think that we should be able to do this without dill.

pgkirsch commented 4 years ago

Thanks for closing this so quickly @bqpd, very helpful!