Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions data/solutions/Sol_MPVRP_S_002_s10_d2_p3.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
2: 1 - 2 [2184] - 7 (1280) - 2 [760] - 4 (657) - 3 (1007) - 1 [2183] - 4 (1527) - 1 [1017] - 8 (1673) - 1 [1107] - 10 (1107) - 1 [2184] - 8 (2184) - 2 [658] - 4 (657) - 6 (1) - 2 [2184] - 6 (2184) - 1 [2100] - 6 (2100) - 1
2: 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 2(0.0) - 0(40.0)

3: 1 - 2 [3] - 6 (3) - 1 [1] - 1 (1) - 2 [2402] - 1 (417) - 1 [1042] - 5 (1) - 1 [602] - 5 (3628) - 1
3: 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0)

4: 1 - 1 [1] - 1 (1) - 2 [4144] - 1 (1) - 8 (588) - 1 [1] - 9 (2421) - 1 [1] - 10 (1135) - 1 (1) - 1 [4144] - 10 (2060) - 1 [1021] - 6 (3105) - 1 [4144] - 1 (4144) - 1
4: 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0) - 0(0.0)

5: 1 - 2 [2505] - 10 (1825) - 7 (680) - 2 [2504] - 9 (2504) - 2 [2326] - 3 (2326) - 1 [2505] - 3 (2505) - 1 [2505] - 2 (2505) - 2 [2505] - 10 (2505) - 1 [2505] - 7 (1529) - 2 (976) - 1 [2505] - 7 (2505) - 1 [2007] - 9 (1852) - 7 (155) - 1
5: 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 1(0.0) - 0(49.1)

4
2
89.10
3567.09
Intel® Core™ i7-10850H × 12
57.73
20 changes: 13 additions & 7 deletions pages/static/js/visualisation.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,12 @@ function mapNodeNumber(nodeStr, numGarages, numDepots, numStations) {
}
}

function setTextContentById(id, value) {
const el = document.getElementById(id);
if (!el) return;
el.textContent = value;
}

function updateFileStatus(type, filename) {
const statusEl = document.getElementById(type + 'Status');
const zoneEl = document.getElementById(type + 'Zone');
Expand Down Expand Up @@ -533,14 +539,14 @@ function initData() {

// Update Stats
const metrics = solution.metrics || {};
document.getElementById('stat-dist').textContent = (metrics.total_cost || solution.objective || 0).toFixed(2);
document.getElementById('stat-routing').textContent = (metrics.routing_cost || 0).toFixed(2);
document.getElementById('stat-exchanges').textContent = `0/${totalExchanges}`;
document.getElementById('stat-trucks').textContent = metrics.vehicles_used || trucks.length;
setTextContentById('stat-dist', (metrics.total_cost || solution.objective || 0).toFixed(2));
setTextContentById('stat-routing', (metrics.routing_cost || 0).toFixed(2));
// setTextContentById('stat-exchanges', `0/${totalExchanges}`);
setTextContentById('stat-trucks', metrics.vehicles_used || trucks.length);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using metrics.vehicles_used || trucks.length will incorrectly fall back to trucks.length when vehicles_used is 0 (valid numeric value but falsy). Prefer a nullish check (e.g., ??) or an explicit Number.isFinite/!= null guard so 0 is displayed correctly when that’s what the metrics report.

Suggested change
setTextContentById('stat-trucks', metrics.vehicles_used || trucks.length);
setTextContentById('stat-trucks', metrics.vehicles_used ?? trucks.length);

Copilot uses AI. Check for mistakes.

let totalSegs = trucks.reduce((sum, t) => sum + t.segments.length, 0);
document.getElementById('stat-segments').textContent = totalSegs;
document.getElementById('stat-status').textContent = solution.status || 'Loaded';
setTextContentById('stat-segments', totalSegs);
setTextContentById('stat-status', solution.status || 'Loaded');

// Update Fleet Legend
const legendEl = document.getElementById('fleet-legend');
Expand Down Expand Up @@ -1011,7 +1017,7 @@ function updateUI() {
calculateCurrentExchangesAndDeliveries();

// Update exchanges display
document.getElementById('stat-exchanges').textContent = `${currentExchanges}/${totalExchanges}`;
// document.getElementById('stat-exchanges').textContent = `${currentExchanges}/${totalExchanges}`;

// Update depot inventory panel
updateDepotInventoryPanel();
Expand Down
6 changes: 5 additions & 1 deletion pages/visualisation.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ <h2><a href="../index.html" style="text-decoration: none; color: inherit;">MPVRP
<span class="metric-value" id="stat-routing">0.00</span>
<span class="metric-label">Routing Cost</span>
</div>
<div class="metric">
<!--<div class="metric">
<span class="metric-value" id="stat-exchanges">0</span>
<span class="metric-label">Exchanges</span>
</div>-->
<div class="metric">
<span class="metric-value" id="stat-trucks">0</span>
<span class="metric-label">Trucks</span>
</div>
<div class="metric">
<span class="metric-value" id="stat-segments">0</span>
Expand Down
Loading