Esvanth commited on
Commit
900fed5
Β·
1 Parent(s): 2133376

Fix duplicate element ID in benchmark loop, improve agent stats display

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -444,12 +444,16 @@ with T1:
444
  st.markdown("<div class='section-label' style='margin-top:12px'>All agents</div>",unsafe_allow_html=True)
445
  for nm in agent_names:
446
  km=_route_km(ROUTES[nm]); c=AGENT_COL[nm]
447
- hi=next((i for i,n in enumerate(ROUTES[nm]) if n!="Depot" and STOPS[n][2]>=4),"-")
 
 
448
  st.markdown(
449
  f"<div style='border-left:3px solid {c};padding:6px 10px;"
450
  f"margin:4px 0;background:{'#f8fafc' if nm!=agent else c+'12'};border-radius:0 6px 6px 0'>"
451
- f"<b style='font-size:.82rem'>{nm}</b> &nbsp;"
452
- f"<span style='color:{MUTE};font-size:.78rem'>{km} km Β· 1st star: step {hi}</span>"
 
 
453
  f"</div>",unsafe_allow_html=True)
454
 
455
  # ── auto-play ─────────────────────────────────────────────────────────────
@@ -700,7 +704,7 @@ with T4:
700
  margin=dict(l=40,r=20,t=50,b=30),
701
  legend=dict(bgcolor=SURF,bordercolor=LINE))
702
  fl.update_xaxes(gridcolor=LINE); fl.update_yaxes(gridcolor=LINE)
703
- chart_ph.plotly_chart(fl,use_container_width=True)
704
 
705
  prog.empty(); status_ph.empty()
706
  df_b=pd.DataFrame(rows)
 
444
  st.markdown("<div class='section-label' style='margin-top:12px'>All agents</div>",unsafe_allow_html=True)
445
  for nm in agent_names:
446
  km=_route_km(ROUTES[nm]); c=AGENT_COL[nm]
447
+ rt=ROUTES[nm]
448
+ hi=next((i for i,n in enumerate(rt) if n!="Depot" and STOPS[n][2]>=4),"-")
449
+ prio_sum=sum(STOPS[n][2] for n in rt if n!="Depot")
450
  st.markdown(
451
  f"<div style='border-left:3px solid {c};padding:6px 10px;"
452
  f"margin:4px 0;background:{'#f8fafc' if nm!=agent else c+'12'};border-radius:0 6px 6px 0'>"
453
+ f"<b style='font-size:.82rem'>{nm}</b><br>"
454
+ f"<span style='color:{MUTE};font-size:.78rem'>"
455
+ f"Distance: {km} km &nbsp;|&nbsp; Priority pts: {prio_sum}<br>"
456
+ f"First ⭐ stop: step {hi}</span>"
457
  f"</div>",unsafe_allow_html=True)
458
 
459
  # ── auto-play ─────────────────────────────────────────────────────────────
 
704
  margin=dict(l=40,r=20,t=50,b=30),
705
  legend=dict(bgcolor=SURF,bordercolor=LINE))
706
  fl.update_xaxes(gridcolor=LINE); fl.update_yaxes(gridcolor=LINE)
707
+ chart_ph.plotly_chart(fl,use_container_width=True,key=f"bench_{done}")
708
 
709
  prog.empty(); status_ph.empty()
710
  df_b=pd.DataFrame(rows)