The code below gives multiple errors. Did I define my problem in the wrong way, or is this a bug?
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-d91e210c618c> in <module>
5 pf=problem.pareto_front(use_cache=False),
6 save_history=True,
----> 7 verbose=False)
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/optimize.py in minimize(problem, algorithm, termination, **kwargs)
56
57 # actually execute the algorithm
---> 58 res = algorithm.solve()
59
60 # store the copied algorithm in the result object
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/model/algorithm.py in solve(self)
152
153 # call the algorithm to solve the problem
--> 154 self._solve(self.problem)
155
156 # store the resulting population
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/model/algorithm.py in _solve(self, problem)
201 self.n_gen = 1
202 self._initialize()
--> 203 self._each_iteration(self, first=True)
204
205 # while termination criterion not fulfilled
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/model/algorithm.py in _each_iteration(self, D, first, **kwargs)
229 self.history, self.callback = None, None
230
--> 231 obj = copy.deepcopy(self)
232 self.history = hist
233 self.callback = _callback
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_list(x, memo, deepcopy)
213 append = y.append
214 for a in x:
--> 215 append(deepcopy(a, memo))
216 return y
217 d[list] = _deepcopy_list
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_list(x, memo, deepcopy)
213 append = y.append
214 for a in x:
--> 215 append(deepcopy(a, memo))
216 return y
217 d[list] = _deepcopy_list
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/usr/lib64/python3.6/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
278 if state is not None:
279 if deep:
--> 280 state = deepcopy(state, memo)
281 if hasattr(y, '__setstate__'):
282 y.__setstate__(state)
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/usr/lib64/python3.6/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
/usr/lib64/python3.6/copy.py in deepcopy(x, memo, _nil)
167 reductor = getattr(x, "__reduce_ex__", None)
168 if reductor:
--> 169 rv = reductor(4)
170 else:
171 reductor = getattr(x, "__reduce__", None)
TypeError: can't pickle _thread.RLock objects
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-fec0f54fcc98> in <module>
5 pf=problem.pareto_front(use_cache=False),
6 save_history=True,
----> 7 verbose=True)
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/optimize.py in minimize(problem, algorithm, termination, **kwargs)
56
57 # actually execute the algorithm
---> 58 res = algorithm.solve()
59
60 # store the copied algorithm in the result object
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/model/algorithm.py in solve(self)
152
153 # call the algorithm to solve the problem
--> 154 self._solve(self.problem)
155
156 # store the resulting population
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/model/algorithm.py in _solve(self, problem)
201 self.n_gen = 1
202 self._initialize()
--> 203 self._each_iteration(self, first=True)
204
205 # while termination criterion not fulfilled
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/model/algorithm.py in _each_iteration(self, D, first, **kwargs)
216 # display the output if defined by the algorithm
217 if self.verbose and self.func_display_attrs is not None:
--> 218 disp = self.func_display_attrs(self.problem, self.evaluator, self, self.pf)
219 if disp is not None:
220 self._display(disp, header=first)
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/util/display.py in disp_multi_objective(problem, evaluator, algorithm, pf)
70 if len(feasible) > 0:
71 if pf is not None:
---> 72 attrs.append(('igd', format_float(IGD(pf).calc(F[feasible])), width))
73 attrs.append(('gd', format_float(GD(pf).calc(F[feasible])), width))
74 if problem.n_obj == 2:
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/model/indicator.py in calc(self, F)
47 self.range = np.ones(self.n_dim)
48
---> 49 return self._calc(F)
50
51 @abc.abstractmethod
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/performance_indicator/distance_indicator.py in _calc(self, F)
24
25 def _calc(self, F):
---> 26 D = vectorized_cdist(self.pf, F, func_dist=self.dist_func, norm=self.range)
27 return np.mean(np.min(D, axis=self.axis))
28
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/util/misc.py in vectorized_cdist(A, B, func_dist, **kwargs)
100 v = np.tile(B, (A.shape[0], 1))
101
--> 102 D = func_dist(u, v, **kwargs)
103 M = np.reshape(D, (A.shape[0], B.shape[0]))
104 return M
/data/user/bellotti_r/.env/lib64/python3.6/site-packages/pymoo/performance_indicator/distance_indicator.py in euclidean_distance(a, b, norm)
6
7 def euclidean_distance(a, b, norm=None):
----> 8 return np.sqrt((((a - b) / norm) ** 2).sum(axis=1))
9
10
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'