@@ -170,7 +170,8 @@ def gap_estimators(xhat,solvername, scenario_names, scenario_creator, ArRP=1,
170
170
scenario_creator_kwargs = scenario_creator_kwargs )
171
171
#Evaluating xhat and xstar and getting the value of the objective function
172
172
#for every (local) scenario
173
-
173
+ global_toc (f"xhat={ xhat } " )
174
+ global_toc (f"xstar={ xstar } " )
174
175
ev .evaluate (xhat )
175
176
objs_at_xhat = ev .objs_dict
176
177
ev .evaluate (xstar )
@@ -328,7 +329,7 @@ def bm_sampsize(self,k,G,s,nk_m1, r=2):
328
329
raise RuntimeError ("We need the confidence level to compute the constant cp" )
329
330
j = np .arange (1 ,1000 )
330
331
s = sum (np .power (j ,- p * np .log (j )))
331
- c = max (1 ,2 * np .log (s / (np .sqrt (2 * np .pi )* confidence_level )))
332
+ c = max (1 ,2 * np .log (s / (np .sqrt (2 * np .pi )* ( 1 - confidence_level ) )))
332
333
333
334
lower_bound = (c + 2 * p * np .log (k )** 2 )/ ((h - hprime )** 2 )
334
335
else :
@@ -340,9 +341,10 @@ def bm_sampsize(self,k,G,s,nk_m1, r=2):
340
341
RuntimeError ("We need the confidence level to compute the constant c_pq" )
341
342
j = np .arange (1 ,1000 )
342
343
s = sum (np .exp (- p * np .power (j ,2 * q / r )))
343
- c = max (1 ,2 * np .log (s / (np .sqrt (2 * np .pi )* confidence_level )))
344
+ c = max (1 ,2 * np .log (s / (np .sqrt (2 * np .pi )* ( 1 - confidence_level ) )))
344
345
345
- lower_bound = (c + 2 * p * np .power (k ,2 * q / r ))/ ((h - hprime )** 2 )
346
+ lower_bound = (c + 2 * p * np .power (k ,2 * q / r ))/ ((h - hprime )** 2 )
347
+ #print(f"nk={lower_bound}")
346
348
return int (np .ceil (lower_bound ))
347
349
348
350
def bpl_fsp_sampsize (self ,k ,G ,s ,nk_m1 ):
@@ -399,12 +401,13 @@ def run(self,maxit=200):
399
401
r = 2 #TODO : we could add flexibility here
400
402
j = np .arange (1 ,1000 )
401
403
if self .q is None :
402
- s = sum (np .power (j ,- self .p * np .log (j )))
404
+ s = sum (np .power (j ,- self .p * np .log (j )))
403
405
else :
404
406
if self .q < 1 :
405
407
raise RuntimeError ("Parameter q should be greater than 1." )
406
408
s = sum (np .exp (- self .p * np .power (j ,2 * self .q / r )))
407
- self .c = max (1 ,2 * np .log (s / (np .sqrt (2 * np .pi )* self .confidence_level )))
409
+ self .c = max (1 ,2 * np .log (s / (np .sqrt (2 * np .pi )* (1 - self .confidence_level ))))
410
+
408
411
409
412
nk = self .ArRP * int (np .ceil (self .sample_size (k , None , None , None )/ self .ArRP ))
410
413
0 commit comments