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

All bin_packing predicates crash when no items are given #865

Open
informarte opened this issue Nov 11, 2024 · 1 comment
Open

All bin_packing predicates crash when no items are given #865

informarte opened this issue Nov 11, 2024 · 1 comment
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release

Comments

@informarte
Copy link

All bin-packing predicates crash when no items are given. For example,

include "bin_packing.mzn";

constraint bin_packing(10, [], []);

results in

/tmp/bin_packing_test.mzn:3.12-34
  in call 'bin_packing'
/home/informarte/Software/lib/MiniZincIDE-2.8.7-bundle-linux-x86_64/share/minizinc/std/bin_packing.mzn:18.5-24.7
  in call 'assert'
/home/informarte/Software/lib/MiniZincIDE-2.8.7-bundle-linux-x86_64/share/minizinc/std/bin_packing.mzn:20.5-24.6
  in call 'assert'
  in binary '>=' operator expression
  in call 'lb_array'

I would expect the predicates to behave as follows when there are no items:

  • bin_packing and bin_packing_capa reduce to true
  • bin_packing_load(load, bin, w) reduces to forall(l in load)(l = 0)
  • bin_packing_load_fn yields an empty array

Interestingly, cumulative does not suffer from this issue: When there are no tasks, it reduces to true.

@Dekker1
Copy link
Member

Dekker1 commented Nov 12, 2024

Thank you for bringing this to our attention. Not too long ago, I went over a decent chunk of the global constraints to make sure that they work with “empty” input, but I must have missed these.

@Dekker1 Dekker1 added bug resolved Issue is resolved and the feature or fix will be part of next release labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release
Projects
None yet
Development

No branches or pull requests

2 participants