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

Detect all conflicts on Engine::check_solution #137

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Dekker1
Copy link
Contributor

@Dekker1 Dekker1 commented Nov 19, 2024

No description provided.

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
crates/huub/src/solver/engine.rs 77.28% <ø> (ø)

... and 1 file with indirect coverage changes


🚨 Try these New Features:

@Dekker1 Dekker1 force-pushed the feat/check_sol_mult_conflict branch from 180cf56 to 8146152 Compare November 19, 2024 02:55
Copy link

codspeed-hq bot commented Nov 19, 2024

CodSpeed Performance Report

Merging #137 will degrade performances by 65.8%

Comparing Dekker1:feat/check_sol_mult_conflict (405e001) with develop (4aa742b)

Summary

⚡ 1 improvements
❌ 2 regressions
✅ 10 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark develop Dekker1:feat/check_sol_mult_conflict Change
optimization[jobshop_la02] 390.6 ms 694.5 ms -43.77%
optimization[jobshop_la03] 178.4 ms 521.5 ms -65.8%
optimization[jobshop_la04] 400.9 ms 321.7 ms +24.64%

@Dekker1
Copy link
Contributor Author

Dekker1 commented Nov 19, 2024

@AllenZzw This was one of the changes that we discussed. It seems to affect the job shop benchmarks mostly negatively, but it's unclear to me whether this is just because of a different search order, and we are unlucky in 2 out of 3 changes. In general, giving more information back to the SAT solver with no change in runtime for check_solution would seem good.

Could you run a larger test suite to see whether this is worthwhile or not (independent of propagator deactivation)?

// detected
if let Some(conflict) = ctx.state.conflict.take() {
// Move conflict to clauses before backtrack
ctx.state.clauses.push_back(conflict);
Copy link
Collaborator

@AllenZzw AllenZzw Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The normal clauses in state.clauses and conflict clauses in state.conflict seems to be handled differently in add_external_clause. Shall we change the conflict variable into a vector to ensure the consistent handling of conflicts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is that state.clauses are persistent, and will be kept even when you backtrack. We could change conflict to be a vector and capture all conflicts immediately, but it would still require the move to state.clauses because we immediately backtrack afterwards in check_solutions. (Note that the other difference is that all other clauses and propagations are posted before the conflict, to ensure it will cause conflict in the SAT solver. However, since conflicts are added to the end of the list and there cannot be any propagations, this is not a problem).

So if we stick to my proposed design, where we detect all conflicts in check_solutions, but find only the first in propagate, then don't think we need to change it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Probably the performance change is due to the search heuristic. Let me test it using a larger benchmark and also try the --vsids-only option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be great! Thanks :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with jobshop and openshop instances. The performance seems to remain the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the performance is just the same, then I'm not sure whether the change is worthwhile.

Like we discussed in person: only one of the clauses is used in conflict resolution, so any other given clauses are added to the clause database “as is”. I'm not sure whether this wouldn't be something we would hope to avoid.

I'll at least make another branch that ensures that conflict clauses in check_solution are still added as “removable” clauses.

@Dekker1 Dekker1 force-pushed the feat/check_sol_mult_conflict branch from 8146152 to 405e001 Compare November 20, 2024 22:25
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