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

perf: implement a form of VSIDS #67

Merged
merged 2 commits into from
Sep 30, 2024
Merged

Conversation

baszalmstra
Copy link
Contributor

@baszalmstra baszalmstra commented Sep 30, 2024

This PR implements a form of Variable State Independent Decaying Sum (VSIDS) used in many modern solvers.

Background

VSIDS attempts to score each variable with an activity score and decaying the value over time. During decision time a literal is chosen with the highest activity score. Variables' activity score increases when they are part of a conflict. All variables' activity scores decrease after n conflict by multiplying them with a certain decay factor.

Different solvers have slightly different implementations, the amount by which the activity score is increased, the decay factor, after how many conflicts the activities decay, and which variables are increased as part of the conflict.

I found this a good read: https://ar5iv.labs.arxiv.org/html/1506.08905

Implementation differences

The implementation in resolvo also differs from the theory:

  • Resolvo does not score individual variables but instead scores package names. This is because resolvo does not just pick any variable to assign, but instead picks the candidate that maximizes the version picked for a certain package. I think therefore it does not make sense to score the individual variables but instead score the packages to which those variables belong.
  • Similar to MiniSAT our implementation decays activity scores after each conflict (n=1), increases the scores of packages involved in the conflict by 1.0 and decays scores by 0.95.
  • Different from MiniSAT we only increase the scores of the packages that are part of the learnt clause. After benchmarking this turned out to perform better.

@baszalmstra
Copy link
Contributor Author

This is the benchmark comparison with current main (e1d5665):

Untitled

This is the benchmark comparison with #66 :

Untitled

@baszalmstra baszalmstra marked this pull request as draft September 30, 2024 07:54
@baszalmstra baszalmstra changed the title fix: improve logging output perf: implement a form of VSIDS Sep 30, 2024
src/solver/mod.rs Outdated Show resolved Hide resolved
@baszalmstra baszalmstra merged commit 3177b92 into mamba-org:main Sep 30, 2024
13 checks passed
@baszalmstra baszalmstra deleted the perf/vsids branch September 30, 2024 10:12
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