Log in

WORHP Kata of April 2023: Maximum Euclidean distance ⌚ 2023-04-01

A kata (in the context of programming) is a small training unit to practise coding. In this series of WORHP Katas we present standard problems of optimization which you can use to get familiar with optimization (and our optimization software WORHP).

Kata: We want to find the line which minimizes the maximum Euclidean distance to the points :

Hint #1: There is a differentiable formulation which avoids the usage of max, if or similar.
Hint #2: You could also consider finding the line which minimizes the maximum distance only measured in the y-direction. However, with a little bit of school maths, you can compute the Euclidean distance between each point and the line.

A solution will be provided with the next WORHP Kata.


Solution of last WORHP Kata: For the given ordinate values we need some abscissa values, e.g.


to solve this problem:

Using this CPP code and our solver WORHP, we get after 12 iterations
which fits nicely to our data points: