Convex hull: present primal and dual formulations

Open
#1,737 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp

Research direction

Read the convex hull article and compare its dual formulation with the primal point based formulation described in the issue, using Project Euler 917 as the example mentioned. Work out how to explain the relationship between the two formulations and why interior points can be ignored; done means the article presents both formulations clearly. The issue does not name a file or test, so first locate the convex hull article in the repository.

Written by the indexing model from the issue text.

Description

The article introduces the dual formulation first, such as having a DP like
$$dp[i] = \min_{j < i} (dp[j] + m_j \cdot x_i) + C_i$$

The basic queries are for lines $y = m_j \cdot x + c_j$: evaluate lines at $x = d_i$ to find the lower envelope $\min_j (m_j \cdot d_i + c_j)$

However for problems like Project Euler 917, the primal formulation is with a linear cost like cost(x,y) = m * x + y querying directly on the points (x, y). Instead of maintaining a set of lines and computing where it crosses the hull, you just consider convex hull points directly, and you can reason to ignore interior points because they lie above the segments along the convex hull.

Idk if that makes sense. Basically mine is presented as if you already have the convex hull constructed, you can work directly with points. The math ends up the same but I think they are operating in some kind of point-line duality

Dominant language
C++
Stars
11.2k
Forks
2.2k
Avg merge
1d 9h
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cp-algorithms/cp-algorithms

All issues in cp-algorithms/cp-algorithms

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.