@@ -1342,33 +1342,30 @@ def test_minimize_const(self):
13421342
13431343 bm , options = qdb .util ._resource_allocation_plot_helper (
13441344 _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
13471347 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 ]
13481351 print ('MaxRSSRaw' , k , a , b )
1349- kt , at , bt , = 1.0 , 31054903.94825936 , 92712486.20047534
1350-
13511352 self .assertEqual (bm , qdb .util .mem_model4 , msg = """Best memory model
13521353 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" )
13561355
1356+ # check that the algorithm chooses correct model for ElapsedRaw and
1357+ # has 1 failure
13571358 bm , options = qdb .util ._resource_allocation_plot_helper (
13581359 _df , axs [1 ], self .CNAME , self .SNAME , 'ElapsedRaw' , self .model_time )
13591360 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 ]
13601364 print ('ElapsedRaw' , k , a , b )
1361- kt = 19107.88377185
1362- at = - 36985.06461777
1363- bt = - 36985.06461796
13641365
1365- # check that the algorithm calculates correct constants and chooses
1366- # correct model for ElapsedRaw
13671366 self .assertEqual (bm , qdb .util .time_model1 , msg = """Best time model
13681367 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" )
13721369
13731370
13741371STUDY_INFO = {
0 commit comments