Skip to content

New coloring methods #43

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

Merged
merged 19 commits into from
Jul 16, 2019
Merged

New coloring methods #43

merged 19 commits into from
Jul 16, 2019

Conversation

pkj-m
Copy link
Contributor

@pkj-m pkj-m commented Jul 1, 2019

#29

@pkj-m
Copy link
Contributor Author

pkj-m commented Jul 1, 2019

While it doesn't make a lot of sense to use star coloring for simple Jacobian computation using orthogonal column partitioning followed by forward mode AD or finite differencing, it can be used later for easier implementation of substitution-based recovery methods.

I ran the new algorithm on some random and special graphs and this is what I observed.

For a star graph with 200,000 vertices:

  • the original greedy algorithm takes 46.170148 seconds (400.01 k allocations: 298.040 GiB, 19.11% gc time)

  • the new star coloring algorithm takes 324.176172 seconds (8 allocations: 3.052 MiB) which is probably the worst case for this algorithm.

So evidently the simple coloring algorithm performs better in this case, by an order of magnitude. We should also take note of the huge difference in the number of allocations and memory consumed.

For a cycle graph again with 200,000 vertices,

  • the original greedy algorithm takes 44.821616 seconds (400.01 k allocations: 298.040 GiB, 18.88% gc time)

  • the star coloring algorithm takes 0.008580 seconds (8 allocations: 3.052 MiB)

Thus, for cycle graphs, our new star coloring algorithm is much, much faster than the original greedy coloring, in terms of both time and memory use. However, note that star coloring would return the coloring vector [1, 2, 3, 1, 2, 3,...] while the original algorithm would return [1, 2, 1, 2...]. Although I think the huge difference in time taken to compute the vector would easily nullify any advantage that one less f call could provide.

Finally, for randomized input graphs with number of vertices varying from 500 to 2500 and edges per graph varying from (1, V^2), where V is the number of vertices, the original algorithm came up with solutions for all 5 test cases in under a second, while the star coloring algorithm failed to come up with a solution even after 2 minutes, so it's safe to say that without further optimizations, there is no reason to use star coloring as a primary coloring mechanism.

EDIT: added latest data

@matbesancon
Copy link
Contributor

Given that you don't use vertex removal, any graph can be passed (not only VSafeGraph). For the tests, generate a bunch of graphs, and compute the coloring using different algorithms. One basic property you can test is that the coloring is a valid one. Another one is that the number of colors is upper-bounded (you have to know the true minimum number of colors for that)

@matbesancon
Copy link
Contributor

In your tests, you could add the two reference graphs from page 664, fig 4.3

@matbesancon
Copy link
Contributor

@pkj-m you are missing random in the package it seems, go to the project, ]add Random

@pkj-m pkj-m changed the title [WIP] New coloring methods New coloring methods Jul 9, 2019
@pkj-m pkj-m merged commit ceb3d57 into JuliaDiff:master Jul 16, 2019
@pkj-m pkj-m deleted the coloring branch July 16, 2019 14:35
@pkj-m pkj-m mentioned this pull request Aug 7, 2019
3 tasks
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