Closed jgbarcos closed 5 years ago
Hi, I have come across this problem while using the library.
Here, sample_size is not being casted to integer after round, resulting in sample_size being a float:
sample_size
round
https://github.com/coin-or/rbfopt/blob/8379229de40721cd1160869f602eb126c8b3d552/src/rbfopt/rbfopt_utils.py#L464-L465
This causes trouble down the line as np.random.permutationrequires an integer (it raises IndexError: tuple index out of range when it's a float):
np.random.permutation
IndexError: tuple index out of range
https://github.com/coin-or/rbfopt/blob/8379229de40721cd1160869f602eb126c8b3d552/src/rbfopt/rbfopt_utils.py#L305-L306
Here is a minimal code example that triggers an error due to sample_size being float.
import rbfopt import numpy as np def obj_funct(x): return x[0]*x[1] - np.sum(x[2:]) types = np.array(['R', 'R', 'I', 'I']) dim = len(types) lB = np.array([0] * dim) uB = np.array([10] * dim) bb = rbfopt.RbfoptUserBlackBox(dim, lB, uB, types, obj_funct) settings = rbfopt.RbfoptSettings(max_evaluations=50) alg = rbfopt.RbfoptAlgorithm(settings, bb) val, x, itercount, evalcount, fast_evalcount = alg.optimize()
I hope that this helps to replicate the error (I'm using Python 2.7 and rbfopt installed through pip).
Regards, Javier.
Thanks for pointing this out. Fixed in the latest release: https://github.com/coin-or/rbfopt/commit/9f4943bb875d81daecab6d4de2cff1abc6c447e6
Hi, I have come across this problem while using the library.
Here,
sample_size
is not being casted to integer afterround
, resulting insample_size
being a float:https://github.com/coin-or/rbfopt/blob/8379229de40721cd1160869f602eb126c8b3d552/src/rbfopt/rbfopt_utils.py#L464-L465
This causes trouble down the line as
np.random.permutation
requires an integer (it raisesIndexError: tuple index out of range
when it's a float):https://github.com/coin-or/rbfopt/blob/8379229de40721cd1160869f602eb126c8b3d552/src/rbfopt/rbfopt_utils.py#L305-L306
Here is a minimal code example that triggers an error due to
sample_size
being float.I hope that this helps to replicate the error (I'm using Python 2.7 and rbfopt installed through pip).
Regards, Javier.