@@ -166,7 +166,7 @@ def main():
166166 if lamda_loop > 1 :
167167 break
168168 lamda [...] = lamda_loop
169- MeanVarMip .solve (solver = "SHOT" , options = Options ( relative_optimality_gap = 0 ) )
169+ MeanVarMip .solve (solver = "SHOT" )
170170 MeanVarianceMIP += f"{ (lamda_loop )} ,{ round (MeanVarMip .objective_value , 4 )} ,{ round (PortVariance .records .level [0 ], 4 )} ,{ round (PortReturn .records .level [0 ], 4 )} ,"
171171 x_recs = [str (round (x_rec , 4 )) for x_rec in x .records .level .tolist ()]
172172 MeanVarianceMIP += "," .join (x_recs )
@@ -273,10 +273,10 @@ def main():
273273 if lamda_loop > 1 :
274274 break
275275 lamda [...] = lamda_loop
276- MeanVarWithCost .solve (solver = "SHOT" , options = Options ( relative_optimality_gap = 0 ) )
276+ MeanVarWithCost .solve (solver = "SHOT" )
277277 MeanVarianceWithCost += f"{ round (lamda_loop , 1 )} ,{ round (MeanVarWithCost .objective_value , 4 )} ,{ round (PortVariance .records .level [0 ], 4 )} ,{ round (PortReturn .records .level [0 ], 4 )} ,"
278- x0_recs = [str (round (x_rec , 4 )) for x_rec in x_0 .records .level .tolist ()]
279- x1_recs = [str (round (x_rec , 4 )) for x_rec in x_1 .records .level .tolist ()]
278+ x0_recs = [str (round (x_rec , 4 )) for x_rec in x_0 .records .level .tolist ()] if x_0 . records is not None else []
279+ x1_recs = [str (round (x_rec , 4 )) for x_rec in x_1 .records .level .tolist ()] if x_1 . records is not None else []
280280 MeanVarianceWithCost += "," .join (x0_recs ) + ","
281281 MeanVarianceWithCost += "," .join (x1_recs ) + "\n "
282282 lamda_loop += 0.1
@@ -404,11 +404,11 @@ def main():
404404 if lamda_loop > 1 :
405405 break
406406 lamda [...] = lamda_loop
407- MeanVarRevision .solve (solver = "SHOT" , options = Options ( relative_optimality_gap = 0 ) )
407+ MeanVarRevision .solve (solver = "SHOT" )
408408 MeanVarianceRevision += f"{ MeanVarRevision .status } ,{ round (lamda_loop , 1 )} ,{ round (MeanVarRevision .objective_value , 4 )} ,{ round (PortVariance .records .level [0 ], 4 )} ,{ round (PortReturn .records .level [0 ], 4 )} ,"
409- x_recs = [str (round (x_rec , 4 )) for x_rec in x .records .level .tolist ()]
410- buy_recs = [str (round (x_rec , 4 )) for x_rec in buy .records .level .tolist ()]
411- sell_recs = [str (round (x_rec , 4 )) for x_rec in sell .records .level .tolist ()]
409+ x_recs = [str (round (x_rec , 4 )) for x_rec in x .records .level .tolist ()] if x . records is not None else []
410+ buy_recs = [str (round (x_rec , 4 )) for x_rec in buy .records .level .tolist ()] if buy . records is not None else []
411+ sell_recs = [str (round (x_rec , 4 )) for x_rec in sell .records .level .tolist ()] if sell . records is not None else []
412412 MeanVarianceRevision += "," .join (x_recs ) + ","
413413 MeanVarianceRevision += "," .join (buy_recs ) + ","
414414 MeanVarianceRevision += "," .join (sell_recs ) + "\n "
0 commit comments