@@ -170,7 +170,8 @@ def gap_estimators(xhat,solvername, scenario_names, scenario_creator, ArRP=1,
170170 scenario_creator_kwargs = scenario_creator_kwargs )
171171 #Evaluating xhat and xstar and getting the value of the objective function
172172 #for every (local) scenario
173-
173+ global_toc (f"xhat={ xhat } " )
174+ global_toc (f"xstar={ xstar } " )
174175 ev .evaluate (xhat )
175176 objs_at_xhat = ev .objs_dict
176177 ev .evaluate (xstar )
@@ -328,7 +329,7 @@ def bm_sampsize(self,k,G,s,nk_m1, r=2):
328329 raise RuntimeError ("We need the confidence level to compute the constant cp" )
329330 j = np .arange (1 ,1000 )
330331 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 ) )))
332333
333334 lower_bound = (c + 2 * p * np .log (k )** 2 )/ ((h - hprime )** 2 )
334335 else :
@@ -340,9 +341,10 @@ def bm_sampsize(self,k,G,s,nk_m1, r=2):
340341 RuntimeError ("We need the confidence level to compute the constant c_pq" )
341342 j = np .arange (1 ,1000 )
342343 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 ) )))
344345
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}")
346348 return int (np .ceil (lower_bound ))
347349
348350 def bpl_fsp_sampsize (self ,k ,G ,s ,nk_m1 ):
@@ -399,12 +401,13 @@ def run(self,maxit=200):
399401 r = 2 #TODO : we could add flexibility here
400402 j = np .arange (1 ,1000 )
401403 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 )))
403405 else :
404406 if self .q < 1 :
405407 raise RuntimeError ("Parameter q should be greater than 1." )
406408 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+
408411
409412 nk = self .ArRP * int (np .ceil (self .sample_size (k , None , None , None )/ self .ArRP ))
410413
0 commit comments