This is part of the exercise overhaul described here:
Basically for each exercise, we want to make sure that it is in the context of a story. Not an elaborate story, but something that helps you imagine a concrete scenario and make it just a bit more interesting.
As an example, instead of just “figure out if a sentence is a pangram”, we reframed the exercise to give a reason why you need to do this (you work for a company that makes fonts, and they want to use pangrams to show off the fonts on their website. https://github.com/exercism/problem-specifications/pull/2215).
I’ve been looking at the saddle-points exercise, and I’m a bit stumped, to be honest.
It seems like saddle-points can be used in optimization problems, so I’m trying to frame a story around a logistics/transportation company needing to do some optimization on their routes.
Here’s my current suggestion:
You work for a transportation company that needs to improve the efficiency of their routes.
You have been tasked with developing a program that can help the company identify routes that are problematic. These are locations where there is no optimal solution based purely on distance. The routes through these areas can then be analyzed by experts in the company, to find better solutions.
However, I have no idea if I’m even close to being right about this whole thing.
If someone could help me get this right, I would appreciate it very much.
For context, here are the tweaked instructions:
Your task is to find the saddle points in a matrix representing distances between cities.
A saddle point is a point where the surface curves up in one direction and down in another direction.
The saddle point isn’t the lowest point overall, nor is it the highest point overall.
It represents a point where there is no good solution.
In a matrix, a saddle point is an element that the largest in its row, while being the smallest in its column.
You may find other definitions of matrix saddle points online.
The tests for this exercise follow the above unambiguous definition.
A matrix might not have any saddle points at all.
Or it might have one, or even several.
Here is a matrix that has exactly one saddle point.
1 2 3 4
|-----------
1 | 9 8 7 8
2 | 5 3 2 4 <--- saddle point at row 2, column 1, with value 5
3 | 6 6 7 1
- Row 2 has values 5, 3, and 1. The largest value is 5.
- Column 1 has values 9, 5, and 6. The smallest value is 5.
So the point at [2, 1]
(row: 2, column: 1) is a saddle point with value 5.