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
I get this error frompymoo/core/problem.py when instantiating a subclass of Problem.
In my case I pass vars as a dictionary: vars = { 'x1': Choice(), 'x2' Choice(), 'x3': Integer(lb=1, ub=10) leaving xl and xu as None.
I think there is a problem in this part:
...
self.xl, self.xu = xl, xu
# if the variables are provided in their explicit form
if vars is not None:
self.vars = vars
self.n_var = len(vars)
if self.xl is None:
self.xl = {name: var.lb if hasattr(var, "lb") else None for name, var in vars.items()}
if self.xu is None:
self.xu = {name: var.ub if hasattr(var, "ub") else None for name, var in vars.items()}
...
# if it is a problem with an actual number of variables - make sure xl and xu are numpy arrays
if n_var > 0:
if self.xl is not None:
if not isinstance(self.xl, np.ndarray):
self.xl = np.ones(n_var) * xl
self.xl = self.xl.astype(float)
if self.xu is not None:
if not isinstance(self.xu, np.ndarray):
self.xu = np.ones(n_var) * xu
self.xu = self.xu.astype(float)
xl and xu are not checked to be not None and I'd changed it as:
if n_var > 0:
if xl is not None:
if not isinstance(self.xl, np.ndarray):
self.xl = np.ones(n_var) * xl
self.xl = self.xl.astype(float)
if xu is not None:
if not isinstance(self.xu, np.ndarray):
self.xu = np.ones(n_var) * xu
self.xu = self.xu.astype(float)
self.xl/xu should be a numpy array or a dictionary?
I also don't understand when this values are used, since the upper and lower bound are taken directly from each different variable type, right?
Environment
OS: Ubuntu 20.04
Python Version: 3.7
Package Versions:
numpy: 1.21.6
pymoo: 0.6.0.1
Error Traceback
...
File "/home/user/miniconda3/envs/fatai/lib/python3.7/site-packages/pymoo/core/problem.py", line 158, in __init__
self.xl = np.ones(n_var) * xl
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
The text was updated successfully, but these errors were encountered:
Description
I get this error from
pymoo/core/problem.py
when instantiating a subclass ofProblem
.In my case I pass vars as a dictionary:
vars = { 'x1': Choice(), 'x2' Choice(), 'x3': Integer(lb=1, ub=10)
leavingxl
andxu
asNone
.I think there is a problem in this part:
xl
andxu
are not checked to be notNone
and I'd changed it as:self.xl/xu
should be a numpy array or a dictionary?I also don't understand when this values are used, since the upper and lower bound are taken directly from each different variable type, right?
Environment
Error Traceback
The text was updated successfully, but these errors were encountered: