@@ -1342,33 +1342,30 @@ def test_minimize_const(self):
1342
1342
1343
1343
bm , options = qdb .util ._resource_allocation_plot_helper (
1344
1344
_df , axs [0 ], self .CNAME , self .SNAME , 'MaxRSSRaw' , self .model_mem )
1345
- # check that the algorithm calculates correct constants and chooses
1346
- # correct model for MaxRSSRaw
1345
+ # check that the algorithm chooses correct model for MaxRSSRaw and
1346
+ # has 0 failures
1347
1347
k , a , b = options .x
1348
+ failures_df = qdb .util ._resource_allocation_failures (
1349
+ _df , k , a , b , bm , 'MaxRSSRaw' )
1350
+ failures = failures_df .shape [0 ]
1348
1351
print ('MaxRSSRaw' , k , a , b )
1349
- kt , at , bt , = 1.0 , 31054903.94825936 , 92712486.20047534
1350
-
1351
1352
self .assertEqual (bm , qdb .util .mem_model4 , msg = """Best memory model
1352
1353
doesn't match""" )
1353
- self .assertAlmostEqual (k , kt , msg = "k not match expected in MaxRSSRaw" )
1354
- self .assertAlmostEqual (a , at , msg = "a not match expected in MaxRSSRaw" )
1355
- self .assertAlmostEqual (b , bt , msg = "b not match expected in MaxRSSRaw" )
1354
+ self .assertEqual (failures , 0 , "Number of failures must be 0" )
1356
1355
1356
+ # check that the algorithm chooses correct model for ElapsedRaw and
1357
+ # has 1 failure
1357
1358
bm , options = qdb .util ._resource_allocation_plot_helper (
1358
1359
_df , axs [1 ], self .CNAME , self .SNAME , 'ElapsedRaw' , self .model_time )
1359
1360
k , a , b = options .x
1361
+ failures_df = qdb .util ._resource_allocation_failures (
1362
+ _df , k , a , b , bm , 'ElapsedRaw' )
1363
+ failures = failures_df .shape [0 ]
1360
1364
print ('ElapsedRaw' , k , a , b )
1361
- kt = 19107.88377185
1362
- at = - 36985.06461777
1363
- bt = - 36985.06461796
1364
1365
1365
- # check that the algorithm calculates correct constants and chooses
1366
- # correct model for ElapsedRaw
1367
1366
self .assertEqual (bm , qdb .util .time_model1 , msg = """Best time model
1368
1367
doesn't match""" )
1369
- self .assertAlmostEqual (k , kt , msg = "k not match expected in ElapsedRaw" )
1370
- self .assertAlmostEqual (a , at , msg = "a not match expected in ElapsedRaw" )
1371
- self .assertAlmostEqual (b , bt , msg = "b not match expected in ElapsedRaw" )
1368
+ self .assertEqual (failures , 1 , "Number of failures must be 1" )
1372
1369
1373
1370
1374
1371
STUDY_INFO = {
0 commit comments