@@ -119,13 +119,15 @@ def __init__(
119
119
self ,
120
120
noise_std : None | float | list [float ] = None ,
121
121
negate : bool = False ,
122
+ dtype : torch .dtype = torch .double ,
122
123
) -> None :
123
124
r"""
124
125
Args:
125
126
noise_std: Standard deviation of the observation noise.
126
127
negate: If True, negate the objectives.
128
+ dtype: The dtype that is used for the bounds of the function.
127
129
"""
128
- super ().__init__ (noise_std = noise_std , negate = negate )
130
+ super ().__init__ (noise_std = noise_std , negate = negate , dtype = dtype )
129
131
self ._branin = Branin ()
130
132
131
133
def _rescaled_branin (self , X : Tensor ) -> Tensor :
@@ -179,12 +181,14 @@ def __init__(
179
181
dim : int ,
180
182
noise_std : None | float | list [float ] = None ,
181
183
negate : bool = False ,
184
+ dtype : torch .dtype = torch .double ,
182
185
) -> None :
183
186
r"""
184
187
Args:
185
188
dim: The (input) dimension.
186
189
noise_std: Standard deviation of the observation noise.
187
190
negate: If True, negate the function.
191
+ dtype: The dtype that is used for the bounds of the function.
188
192
"""
189
193
if dim < self ._min_dim :
190
194
raise ValueError (f"dim must be >= { self ._min_dim } , but got dim={ dim } !" )
@@ -194,7 +198,7 @@ def __init__(
194
198
]
195
199
# max_hv is the area of the box minus the area of the curve formed by the PF.
196
200
self ._max_hv = self ._ref_point [0 ] * self ._ref_point [1 ] - self ._area_under_curve
197
- super ().__init__ (noise_std = noise_std , negate = negate )
201
+ super ().__init__ (noise_std = noise_std , negate = negate , dtype = dtype )
198
202
199
203
@abstractmethod
200
204
def _h (self , X : Tensor ) -> Tensor :
@@ -339,13 +343,15 @@ def __init__(
339
343
num_objectives : int = 2 ,
340
344
noise_std : None | float | list [float ] = None ,
341
345
negate : bool = False ,
346
+ dtype : torch .dtype = torch .double ,
342
347
) -> None :
343
348
r"""
344
349
Args:
345
350
dim: The (input) dimension of the function.
346
351
num_objectives: Must be less than dim.
347
352
noise_std: Standard deviation of the observation noise.
348
353
negate: If True, negate the function.
354
+ dtype: The dtype that is used for the bounds of the function.
349
355
"""
350
356
if dim <= num_objectives :
351
357
raise ValueError (
@@ -356,7 +362,7 @@ def __init__(
356
362
self .k = self .dim - self .num_objectives + 1
357
363
self ._bounds = [(0.0 , 1.0 ) for _ in range (self .dim )]
358
364
self ._ref_point = [self ._ref_val for _ in range (num_objectives )]
359
- super ().__init__ (noise_std = noise_std , negate = negate )
365
+ super ().__init__ (noise_std = noise_std , negate = negate , dtype = dtype )
360
366
361
367
362
368
class DTLZ1 (DTLZ ):
@@ -608,12 +614,14 @@ def __init__(
608
614
noise_std : None | float | list [float ] = None ,
609
615
negate : bool = False ,
610
616
num_objectives : int = 2 ,
617
+ dtype : torch .dtype = torch .double ,
611
618
) -> None :
612
619
r"""
613
620
Args:
614
621
noise_std: Standard deviation of the observation noise.
615
622
negate: If True, negate the objectives.
616
623
num_objectives: The number of objectives.
624
+ dtype: The dtype that is used for the bounds of the function.
617
625
"""
618
626
if num_objectives not in (2 , 3 , 4 ):
619
627
raise UnsupportedError ("GMM only currently supports 2 to 4 objectives." )
@@ -623,7 +631,7 @@ def __init__(
623
631
if num_objectives > 3 :
624
632
self ._ref_point .append (- 0.1866 )
625
633
self .num_objectives = num_objectives
626
- super ().__init__ (noise_std = noise_std , negate = negate )
634
+ super ().__init__ (noise_std = noise_std , negate = negate , dtype = dtype )
627
635
gmm_pos = torch .tensor (
628
636
[
629
637
[[0.2 , 0.2 ], [0.8 , 0.2 ], [0.5 , 0.7 ]],
@@ -935,13 +943,15 @@ def __init__(
935
943
num_objectives : int = 2 ,
936
944
noise_std : None | float | list [float ] = None ,
937
945
negate : bool = False ,
946
+ dtype : torch .dtype = torch .double ,
938
947
) -> None :
939
948
r"""
940
949
Args:
941
950
dim: The (input) dimension of the function.
942
951
num_objectives: Number of objectives. Must not be larger than dim.
943
952
noise_std: Standard deviation of the observation noise.
944
953
negate: If True, negate the function.
954
+ dtype: The dtype that is used for the bounds of the function.
945
955
"""
946
956
if num_objectives != 2 :
947
957
raise NotImplementedError (
@@ -954,7 +964,7 @@ def __init__(
954
964
self .num_objectives = num_objectives
955
965
self .dim = dim
956
966
self ._bounds = [(0.0 , 1.0 ) for _ in range (self .dim )]
957
- super ().__init__ (noise_std = noise_std , negate = negate )
967
+ super ().__init__ (noise_std = noise_std , negate = negate , dtype = dtype )
958
968
959
969
@staticmethod
960
970
def _g (X : Tensor ) -> Tensor :
@@ -1246,15 +1256,17 @@ def __init__(
1246
1256
noise_std : None | float | list [float ] = None ,
1247
1257
constraint_noise_std : None | float | list [float ] = None ,
1248
1258
negate : bool = False ,
1259
+ dtype : torch .dtype = torch .double ,
1249
1260
) -> None :
1250
1261
r"""
1251
1262
Args:
1252
1263
noise_std: Standard deviation of the observation noise of the objectives.
1253
1264
constraint_noise_std: Standard deviation of the observation noise of the
1254
1265
constraint.
1255
1266
negate: If True, negate the function.
1267
+ dtype: The dtype that is used for the bounds of the function.
1256
1268
"""
1257
- super ().__init__ (noise_std = noise_std , negate = negate )
1269
+ super ().__init__ (noise_std = noise_std , negate = negate , dtype = dtype )
1258
1270
con_bounds = torch .tensor (self ._con_bounds , dtype = self .bounds .dtype ).transpose (
1259
1271
- 1 , - 2
1260
1272
)
@@ -1357,6 +1369,7 @@ def __init__(
1357
1369
noise_std : None | float | list [float ] = None ,
1358
1370
constraint_noise_std : None | float | list [float ] = None ,
1359
1371
negate : bool = False ,
1372
+ dtype : torch .dtype = torch .double ,
1360
1373
) -> None :
1361
1374
r"""
1362
1375
Args:
@@ -1365,12 +1378,13 @@ def __init__(
1365
1378
constraint_noise_std: Standard deviation of the observation noise of the
1366
1379
constraints.
1367
1380
negate: If True, negate the function.
1381
+ dtype: The dtype that is used for the bounds of the function.
1368
1382
"""
1369
1383
if dim < 2 :
1370
1384
raise ValueError ("dim must be greater than or equal to 2." )
1371
1385
self .dim = dim
1372
1386
self ._bounds = [(0.0 , 1.0 ) for _ in range (self .dim )]
1373
- super ().__init__ (noise_std = noise_std , negate = negate )
1387
+ super ().__init__ (noise_std = noise_std , negate = negate , dtype = dtype )
1374
1388
self .constraint_noise_std = constraint_noise_std
1375
1389
1376
1390
def LA2 (self , A , B , C , D , theta ) -> Tensor :
0 commit comments