Skip to content

Index-error during clause-allocation #119

Closed

Description

@IgnaceBleukx

Hi,

Potentially related to #118 (I encountered this case when minimizing an example for that issue).

I have the following piece of code for generating an UNSAT model:

from pumpkin_py import Model, constraints, Comparator

n = 3    
model = Model()

bvs = [model.new_boolean_variable(name=f"BV{i})") for i in range(n)]
ivs = [model.new_integer_variable(0,1,name=f"IV{i}") for i in range(n)]

neg_scaled = [model.boolean_as_integer(b).scaled(-1) for b in bvs]
model.add_constraint(constraints.LessThanOrEquals(neg_scaled, -1))

for i in range(n):
    is_0 = model.predicate_as_boolean(ivs[i], Comparator.Equal, 0)
    is_1 = model.predicate_as_boolean(ivs[i], Comparator.Equal, 1)

    model.add_constraint(constraints.Clause([is_1]))
    model.add_implication(constraints.Clause([is_0]), bvs[i])

model.satisfy(proof="test")

This raises the error

thread '<unnamed>' panicked at pumpkin-solver/src/engine/sat/clause_allocators/clause_allocator_basic.rs:52:32:
index out of bounds: the len is 0 but the index is 18446744073709551615

I did a little investigation already, and the model runs fine when putting the constaint "sum(bvs) >= 1" all the way at the end of the model.

Feel free to close this issue if the root cause is the same as #118 : )

Activity

  1. maartenflippo commented on Dec 6, 2024

    @maartenflippo
    Contributor

    I will have a look at this on Monday. You could try to see whether this error still persists on the develop branch. Based on the error message I assume you are currently running the latest main.

  2. IgnaceBleukx commented on Dec 6, 2024

    @IgnaceBleukx
    ContributorAuthor

    Thanks! I'm currently indeed running on main

  3. maartenflippo commented on Dec 11, 2024

    @maartenflippo
    Contributor

    I spent some time exploring why this crashes on the develop branch. I have not been able to figure it out yet, and will do more work on it. But I have not forgotten about this issue

  4. added a commit that references this issue on Mar 11, 2025
    8745248
  5. added a commit that references this issue on Apr 11, 2025
    5e31544
  6. added a commit that references this issue on Apr 11, 2025
    857f84c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions