Skip to content

Improve weightedmatching#319

Open
Matistjati wants to merge 7 commits into
kth-competitive-programming:mainfrom
Matistjati:jonker-volgenant
Open

Improve weightedmatching#319
Matistjati wants to merge 7 commits into
kth-competitive-programming:mainfrom
Matistjati:jonker-volgenant

Conversation

@Matistjati

@Matistjati Matistjati commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Update our code for weighted matching.
The new one:

  • Makes it easy if costs are non-int (long long or double). int is way too small
  • Does not require you to specify an infinity for your type
  • Runs faster (on the problem I've tested on)
  • Fewer LOC (24 vs 32). Slightly more non-whitespace chars: went from 556 to 601

This code was produced by taking Jeremy Lim's implementation of Jonker-Volgenant, and then getting LLMs to golf it for a couple of hours. There might have been some performance loss from this.

Benchmarks. The ones other assignment problem use an older version that should compile the same. Take the exact numbers with a grain of salt, the variance seems to quite large:

@simonlindholm

Copy link
Copy Markdown
Member

I think we should keep allowing n = 0, it feels like it comes up quite naturally. rep(i,f,t) rather than rep(i, f, t) to keep with existing style. Not super happy about the unnatural line breaks or overuse of comma expressions. Shortening potential might allow some of the line breaks to be fixed maybe.

Comment thread content/graph/WeightedMatching.h Outdated
Comment thread content/graph/WeightedMatching.h Outdated
Matistjati and others added 2 commits July 10, 2026 10:52
Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>
Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>
Comment thread content/graph/WeightedMatching.h Outdated
Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>
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