Skip to content

feat: Greedy trimming of linear inequality nogoods - #284

Closed
k-sidorov wants to merge 1 commit into
mainfrom
feat/compact-linear-explanations
Closed

k-sidorov wants to merge 1 commit into
mainfrom
feat/compact-linear-explanations

Conversation

@k-sidorov

Copy link
Copy Markdown
Contributor

This PR improves the nogoods posted by the linear_less_or_equal constraint by choosing the irreducible subset of the conflict reasons before handing the nogood to the solver. This trimming also yields the smallest set of reasons with such property.

@k-sidorov

Copy link
Copy Markdown
Contributor Author

MiniZinc scoring vs. main:

  • This PR: 182.93
  • main: 183.08

Area scoring:

  • This PR: 32.02
  • main: 28.75

@k-sidorov k-sidorov changed the title Greedy trimming of linear inequality nogoods feat: Greedy trimming of linear inequality nogoods Sep 11, 2025
@maartenflippo

Copy link
Copy Markdown
Contributor

Given the benchmark results, I don't know how I feel about merging this. We would be adding quite a bit of complexity for not a lot of gains.

Could you try to evaluate on fully linearized instances? That is the most extreme case for linear propagators, so it would be useful to know if there is a difference in that scenario.

@k-sidorov
k-sidorov marked this pull request as ready for review September 11, 2025 14:01
@EmirDe

EmirDe commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

Given the benchmark results, I don't know how I feel about merging this. We would be adding quite a bit of complexity for not a lot of gains.

Could you try to evaluate on fully linearized instances? That is the most extreme case for linear propagators, so it would be useful to know if there is a difference in that scenario.

Nice to see this change implemented! Over the years we talked about it but never got around to getting it in the solver!

It is quite surprising it has no impact. Is it that in practice it never reduces the explanation or it does manage but that negatively impacts search?

In the current form, this PR adds complexity without a clear advantage, so I would keep it unmerged for now.

(I agree about the idea of testing with fully linearlised problems!)

@k-sidorov

Copy link
Copy Markdown
Contributor Author

It is quite surprising it has no impact. Is it that in practice it never reduces the explanation or it does manage but that negatively impacts search?

From my observations, it does manage to reduce the explanation size, and it even translates to a lower number of conflicts (sometimes), but it does not reduce the explanation size by a lot. The problem, apparently, is that (1) removing the pesky redundant literals requires sorting every single nogood we process, at least in the current implementation, but (2) linear constraints are not too computationally expensive for policing: track the cumulative lower bound, crop everything that spills over, and halt if the current solver state already did.

That said, I agree that I do not see much future in this PR. I will close it for now, but if you have an idea of how to streamline my implementation of trimming, let's continue this.

@k-sidorov k-sidorov closed this Sep 15, 2025
ImkoMarijnissen added a commit that referenced this pull request Oct 7, 2025
…#290)

Currently, we use an eager explanation for `<=` constraints which can be
quite expensive if there are many of them, each making several
allocations.

This PR addresses this by lazily calculating the reason for these
propagations. Additionally, in my mind it makes sense to include the
predicate for which the reason is asked when asking for a lazy reason.

_Could also be related to #284; perhaps only doing the trimming for the
lazy explanations is worthwhile_

## TODO
- [x] Profiling
- [x] Merge #297 

**These results are _with_ the changes from #297; without these changes,
the MiniZinc score is worse**

### MiniZinc Scoring
- Main: 173.89
- **Lazy Explanations: 186.12**

### Primal Integral
- **Main: 26.13**
- Lazy Explanations: 26.69
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.

3 participants