You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
I hope to initialize class MyProblem with bounds in arguments, not assign values directly in init(self, dim) like examples. The codes below is wrong, and the error messages is at the end.
fromPyGMO.problemimportbaseclassMyProblem(base):
"""Defined problem needed by PyGMO MyProblem(forward, lower_bound, upper_bound) forward: a instance of class Forward.(Forward is a class about the fitness function) lower_bound, upper_bound: bounds of the problem """def__init__(self, forward, lower_bound, upper_bound):
self.forward=forwarddim=forward.nx_ig*forward.ny_igsuper(MyProblem, self).__init__(dim)
self.set_bounds(lower_bound, upper_bound)
def_objfun_impl(self, x):
f=self.foward.get_obj(x)
return (f, )
defhuman_readable_extra(self):
return"\n\t Problem dimension: "+str(self.__dim)
Traceback (most recent call last):
File "/usr/local/bin/ttinv", line 9, in <module>
load_entry_point('islandopt', 'console_scripts', 'ttinv')()
File "/Users/lei/Work/pagmo_fmm/traveltime/command_line.py", line 43, in main
isl = island(algo, prob, num_individual)
File "/usr/local/lib/python3.5/site-packages/PyGMO/core/__init__.py", line 242, in island
return _generic_island_ctor(None, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/PyGMO/core/__init__.py", line 132, in _generic_island_ctor
return py_island(*args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/PyGMO/core/__init__.py", line 119, in _generic_island_ctor
super(type(self), self).__init__(*ctor_args)
File "/usr/local/lib/python3.5/site-packages/PyGMO/core/__init__.py", line 48, in __init__
_core._base_island.__init__(self, *args)
File "/usr/local/lib/python3.5/site-packages/PyGMO/problem/_base.py", line 36, in __get_deepcopy__
return deepcopy(self)
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/copy.py", line 292, in _reconstruct
y = callable(*args)
TypeError: __init__() missing 3 required positional arguments: 'forward', 'lower_bound', and 'upper_bound'
The text was updated successfully, but these errors were encountered:
I hope to initialize class MyProblem with bounds in arguments, not assign values directly in init(self, dim) like examples. The codes below is wrong, and the error messages is at the end.
The text was updated successfully, but these errors were encountered: