Add int search space

This commit is contained in:
D-X-Y
2021-03-18 16:02:55 +08:00
parent ece6ac5f41
commit 63c8bb9bc8
67 changed files with 5150 additions and 1474 deletions

View File

@@ -13,6 +13,7 @@ if str(lib_dir) not in sys.path:
from spaces import Categorical
from spaces import Continuous
from spaces import Integer
class TestBasicSpace(unittest.TestCase):
@@ -26,6 +27,12 @@ class TestBasicSpace(unittest.TestCase):
"Categorical(candidates=[1, 2, 3, 4], default_index=None)", str(space)
)
def test_integer(self):
space = Integer(lower=1, upper=4)
for i in range(4):
self.assertEqual(space[i], i + 1)
self.assertEqual("Integer(lower=1, upper=4, default=None)", str(space))
def test_continuous(self):
random.seed(999)
space = Continuous(0, 1)