Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster jump number for posets #24631

Closed
jm58660 mannequin opened this issue Feb 1, 2018 · 12 comments
Closed

Faster jump number for posets #24631

jm58660 mannequin opened this issue Feb 1, 2018 · 12 comments

Comments

@jm58660
Copy link
Mannequin

jm58660 mannequin commented Feb 1, 2018

Every poset has at least one greedy linear extension with optimal number of jumps. Use this to make a faster function.

CC: @tscrim @fchapoton

Component: combinatorics

Author: Jori Mäntysalo

Branch/Commit: 1306d1f

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/24631

@jm58660 jm58660 mannequin added this to the sage-8.2 milestone Feb 1, 2018
@jm58660 jm58660 mannequin added c: combinatorics labels Feb 1, 2018
@jm58660
Copy link
Mannequin Author

jm58660 mannequin commented Feb 1, 2018

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 1, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

bcd3f04Explain algoirthm.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 1, 2018

Commit: bcd3f04

@jm58660
Copy link
Mannequin Author

jm58660 mannequin commented Feb 1, 2018

comment:3

The speedup is enormous, try to compute the jump number of posets.BooleanLattice(4) or something similar.

@jm58660 jm58660 mannequin added the s: needs review label Feb 1, 2018
@tscrim
Copy link
Collaborator

tscrim commented Feb 2, 2018

comment:5

Isn't this just a backtracking algorithm? I think you should put a little more into the algorithm description (essentially explaining what "greedy" means in this context).

Instead of your nonlocals, why not just return the result, which will propagate up? In a similar vein, it is usually better to manually do the backtracking rather than use recursion (faster, and in Python, no [artificial] depth limit), but that is not something I will hold this ticket up for.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 2, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

1306d1fExplain algorithm.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 2, 2018

Changed commit from bcd3f04 to 1306d1f

@jm58660
Copy link
Mannequin Author

jm58660 mannequin commented Feb 2, 2018

comment:7

Replying to @tscrim:

Isn't this just a backtracking algorithm? I think you should put a little more into the algorithm description (essentially explaining what "greedy" means in this context).

Added that.

Instead of your nonlocals, why not just return the result, which will propagate up? In a similar vein, it is usually better to manually do the backtracking rather than use recursion (faster, and in Python, no [artificial] depth limit), but that is not something I will hold this ticket up for.

Recursion depth can not be a problem here; we can propably never compute jump number of 100-element posets, unless it has very small width (and if so, we should optimize by doing series-parallel decomposition). But yes, it would be faster not to use recursion.

Returning a result is not enought if we want to cut the computation based on earlier result.

@tscrim
Copy link
Collaborator

tscrim commented Feb 2, 2018

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Feb 2, 2018

comment:8

Okay. LGTM.

@jm58660
Copy link
Mannequin Author

jm58660 mannequin commented Feb 2, 2018

comment:9

Thanks × 3.

@vbraun
Copy link
Member

vbraun commented Feb 3, 2018

Changed branch from u/jmantysalo/faster_jump_number_for_posets to 1306d1f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants