@@ -300,14 +300,14 @@ fn select_assets_for_cycle(
300300 previously_selected_assets : & [ AssetRef ] ,
301301 writer : & mut DataWriter ,
302302) -> Result < Vec < AssetRef > > {
303- // Get markets to balance: all seen so far plus all in loop
303+ // Get markets to balance: all seen so far plus all in the cycle
304304 let mut markets_to_balance = seen_markets. to_vec ( ) ;
305305 markets_to_balance. extend_from_slice ( markets) ;
306306
307- // Initialise list of unbalanced markets: start with all markets in the cycle
307+ // Initialise queue of unbalanced markets: start with all markets in the cycle
308308 let mut unbalanced_markets = VecDeque :: from ( markets. to_vec ( ) ) ;
309309
310- // Iterate while there are markets in the unbalanced list
310+ // Iterate while there are still markets in the queue, or until max iterations reached
311311 let mut current_demand = demand. clone ( ) ;
312312 let mut selected_assets = HashMap :: new ( ) ;
313313 let mut loop_iter = 0 ;
@@ -321,11 +321,11 @@ fn select_assets_for_cycle(
321321 break ;
322322 }
323323
324- // Pop off the first market
324+ // Pop off the first market from the queue
325325 // If there are no markets with unmet demand, we're done
326326 let Some ( current_market) = unbalanced_markets. pop_front ( ) else {
327327 debug ! (
328- "Cycle investment for '{} ' converged after {} iterations" ,
328+ "Investment for cycle '({}) ' converged after {} iterations" ,
329329 markets. iter( ) . join( ", " ) ,
330330 loop_iter
331331 ) ;
@@ -365,24 +365,21 @@ fn select_assets_for_cycle(
365365 . with_unmet_demand_vars ( & markets_with_unmet_demand)
366366 . run (
367367 & format ! (
368- "cycle ({}) iteration {}" ,
368+ "cycle ({}) post {} investment ( iteration {}) " ,
369369 markets. iter( ) . join( ", " ) ,
370+ & current_market,
370371 loop_iter
371372 ) ,
372373 writer,
373374 ) ?;
374375
375- // Find markets with unmet demand and add these to the unbalanced list if not already present
376+ // Find markets with unmet demand and add these to the queue if not already present
376377 let coms = solution. get_markets_with_unmet_demand ( ) ;
377378 for market in coms {
378379 if !unbalanced_markets. contains ( & market) {
379380 unbalanced_markets. push_back ( market) ;
380381 }
381382 }
382- println ! (
383- "Unbalanced markets: {}" ,
384- unbalanced_markets. iter( ) . join( ", " )
385- ) ;
386383
387384 // Calculate a new demand map for the next iteration
388385 current_demand. clone_from ( demand) ;
0 commit comments