Skip to content

feat: Update visualization metrics and enhance product tracking funct…#30

Merged
rosasbehoundja merged 1 commit into
mainfrom
fix/vizualisation
Mar 23, 2026
Merged

feat: Update visualization metrics and enhance product tracking funct…#30
rosasbehoundja merged 1 commit into
mainfrom
fix/vizualisation

Conversation

@rosasbehoundja
Copy link
Copy Markdown
Contributor

…ionality

Copilot AI review requested due to automatic review settings March 23, 2026 09:13
@rosasbehoundja rosasbehoundja merged commit a45073c into main Mar 23, 2026
3 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the MPVRP-CC solution visualizer to parse richer per-segment solution metadata (product states, depot loads, and station deliveries) and use that data to improve exchange/delivery calculations and depot inventory tracking.

Changes:

  • Extend .dat solution parsing to capture product state lines and segment-level metadata (delivery/load quantities).
  • Update exchange counting and station/depot product accounting to use parsed product states instead of heuristics.
  • Add a new sample solution .dat file; adjust a metric label in the UI; update .gitignore for a backup file.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
pages/visualisation.html Updates the displayed metric label (but currently mismatches the JS metric source).
pages/static/js/visualisation.js Adds parsing and normalization for product lines + segment metadata; updates exchange/delivery and depot inventory logic to use these fields.
data/solutions/Sol_MPVRP_S_005_s7_d1_p3.dat Adds a sample solution file that includes route delivery quantities and product state lines.
.gitignore Ignores a specific backup Python file path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 339 to +344
// Extract quantity from brackets [qty] (depot load)
const bracketMatch = raw.match(/\[(\d+(?:\.\d+)?)\]/);
const loadQty = bracketMatch ? parseFloat(bracketMatch[1]) : 0;
// Extract quantity from parentheses (station delivery in route line)
const parenMatch = raw.match(/\(([-+]?\d*\.?\d+)\)/);
const deliveryQty = parenMatch ? parseFloat(parenMatch[1]) : 0;
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.

deliveryQty is defaulted to 0 when no parentheses are present, which makes it impossible to distinguish “no explicit delivery quantity provided” from an explicit “(0)” in the route. This later causes station deliveries to fall back to demand/visits even when the solution explicitly encodes a 0 delivery. Consider storing deliveryQty as null/undefined when no parentheses are present (or keep a separate hasDeliveryQty flag) so downstream logic can respect explicit zeros.

Copilot uses AI. Check for mistakes.
Comment on lines +1119 to +1120
const explicitDelivery = Number(segMeta.deliveryQty || 0);
const deliveryQty = explicitDelivery > 0
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.

explicitDelivery > 0 treats an explicit “(0)” delivery the same as “no explicit delivery provided”, which will over-report deliveries by falling back to demand/visits. Use a sentinel (e.g., null) or an explicit flag from parsing so that explicit zeros result in a 0 delivery rather than triggering the fallback.

Suggested change
const explicitDelivery = Number(segMeta.deliveryQty || 0);
const deliveryQty = explicitDelivery > 0
let explicitDelivery = null;
if (segMeta.deliveryQty !== undefined && segMeta.deliveryQty !== null && segMeta.deliveryQty !== '') {
const parsedDelivery = Number(segMeta.deliveryQty);
if (!Number.isNaN(parsedDelivery)) {
explicitDelivery = parsedDelivery;
}
}
const deliveryQty = explicitDelivery !== null

Copilot uses AI. Check for mistakes.
Comment thread pages/visualisation.html
<div class="metric">
<span class="metric-value" id="stat-routing">0.00</span>
<span class="metric-label">Routing Cost</span>
<span class="metric-label">Changes Cost</span>
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.

The label was changed to “Changes Cost”, but stat-routing is still populated from metrics.routing_cost in visualisation.js. Please align the label/element id with the metric being displayed (either restore “Routing Cost” or update the JS + metric naming so this field truly shows the changes cost).

Suggested change
<span class="metric-label">Changes Cost</span>
<span class="metric-label">Routing Cost</span>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants