File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,8 @@ def main(args):
9494 impedance = model .assign_base_demand (
9595 args .use_fixed_transit_cost , iterations == 0 )
9696 log_extra ["status" ]["state" ] = "running"
97- for i in range (1 , iterations + 1 ):
97+ i = 1
98+ while i <= iterations :
9899 log_extra ["status" ]["current" ] = i
99100 try :
100101 log .info ("Starting iteration {}" .format (i ), extra = log_extra )
@@ -109,11 +110,11 @@ def main(args):
109110 "Fatal error occured, simulation aborted." , extra = log_extra )
110111 break
111112 gap = model .convergence .iloc [- 1 , :] # Last iteration convergence
112- if gap ["max_gap" ] < args .max_gap or gap ["rel_gap" ] < args .rel_gap :
113- log_extra ["status" ]['state' ] = 'finished'
114- break
115113 if i == iterations :
116114 log_extra ["status" ]['state' ] = 'finished'
115+ elif gap ["max_gap" ] < args .max_gap or gap ["rel_gap" ] < args .rel_gap :
116+ iterations = i + 1
117+ i += 1
117118 # delete emme strategy files for scenarios
118119 if args .del_strat_files :
119120 dbase_path = os .path .join (os .path .dirname (emme_project_path ), "database" )
You can’t perform that action at this time.
0 commit comments