feat(pumpkin-proof-processor): Minimising number of deductions in trimmed proof by giving marked deductions higher propagation priority - #523
Conversation
…oof stages in the trimmed scaffold
…tion is marked or not. Also split up the conflict detection and the unit propagation over two propagators to prevent unnecessary propagations by unmarked deductions whenever a conflict could also be declared.
maartenflippo
left a comment
There was a problem hiding this comment.
This is really good work, and the results indicate that it is worth doing. Thank you for the contribution. I have one design comment and one code-style comment.
The design comment concerns the processor's memory usage. It is not very optimised at the moment, but this change effectively duplicates the memory used by deductions, since we post two propagators per nogood. I think in this case it makes sense to Rc the predicate slice, so that the conflict checker and the propagation propagator can simply read the same instance of the nogood.
The code-style comment relates to every occurrence where the propagators are modified. There is some duplication in the following pattern:
self.state.get_propagator_mut(conflict_checker_handle).expect(...)
self.state.get_propagator_mut(propagation_handle).expect(...)
Instead, we could add an associated method PostedDeduction::get_propagators_mut(&mut State) -> [&mut DeductionPropagator; 2] that pulls out that pattern, and allows more concise modification of the propagators. Other patterns may also work, but it is worth exploring briefly. If you think it does not significantly impact code quality, you can also ignore it.
…ors and on the nogood_stack. Also refactored propagator deactivation / priority updating to be cleaner.
|
Thank you for the review! I added the requested changes:
|
maartenflippo
left a comment
There was a problem hiding this comment.
I think the get_propagators_mut on State is not ideal. Let's not make changes to State here.
ImkoMarijnissen
left a comment
There was a problem hiding this comment.
Thank you for making this PR, I have some small (mostly stylistic) comments!
I will leave it to @maartenflippo to approve the PR.
ImkoMarijnissen
left a comment
There was a problem hiding this comment.
Thank you for all of the changes!
I have some final comments, but other than that it looks good to me.
as match statement and added additional constant for marked deduction priority.
Closes #432
Short summary of changes
DeductionPropagators that have been marked on thenogood_stackis set to a higher priority than their unmarked counterparts (also see diagram below).DeductionPropagatornow performs either conflict detection XOR unit propagation. This is done to implement staged propagation where we first check whether any unmarked deduction could be used for declaring a conflict before proceeding to use the unmarked deductions for unit propagation.explain_predicatesto prevent including duplicate inferences for the same predicate in one proof stage. This was taken from my team's CS4535 implementation, so I was not the one to come up with it.Prioritylevels to thePropagatorQueueto allow for the two stages of unmarked deductions to be propagated after all model constraints and marked deductions. I have briefly considered to edit the priorities of all other propagators, but as the unmarked deductions need two separate propagation levels, that would result in setting the priority of all propagators to eitherPriority::HighorPriority::Medium, which is likely not desirable.Diagram of Propagation Priority
Preliminary results
I ran the implementation against main (with the fix from point 3 above, as main otherwise runs out of memory very quickly on my machine) on the scaffolds I got from @maartenflippo. I did run into some issues where the pumpkin-proof-processor throws an error on test-scheduling_t20m10r10-17, though this can be replicated on main so it is not because of the changes in this PR (opened an issue for it #527). Additionally, the checker does not accept the proof given for test-scheduling_t50m20r10-17, which I am currently investigating (on main this instance runs out of memory, so this could also be unrelated to the changes in this PR). Another smaller instance that shows a similar problem is Unit-Commitment_L10-T48G10L10 for which I opened an issue #528.
The following results have been checked using the
pumpkin-checker(instances which timed out or contained only a single proof stage in both are omitted):If additional benchmarking/checking is desirable, please let me know!