Skip to content

Add support for the experimental MiniZinc black-box propagator interface#219

Open
Dekker1 wants to merge 1 commit into
Gecode:mainfrom
Dekker1:feat/blackbox
Open

Add support for the experimental MiniZinc black-box propagator interface#219
Dekker1 wants to merge 1 commit into
Gecode:mainfrom
Dekker1:feat/blackbox

Conversation

@Dekker1

@Dekker1 Dekker1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

I'm hoping to sneak this in before the seemingly upcoming Gecode release. This adds support for the experimental Blackbox interface for MiniZinc (and solvers). The idea being that a user can delegate some evaluation/propagation to an external program/library.

The implementation for Chuffed and the MiniZinc compiler is also ready, the latter I hope to merge after the former and this merges such that CI will pass the required tests.

This work will be presented this year at ModRef.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@kalvdans

kalvdans commented Jul 8, 2026

Copy link
Copy Markdown

Please document both the DLL interface functions and the external process protocol, so reviewers can review that the PR adheres to the specification, and so that people can write their own conforming black boxes.

@Dekker1

Dekker1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Please document both the DLL interface functions and the external process protocol, so reviewers can review that the PR adheres to the specification, and so that people can write their own conforming black boxes.

The documentation for the ABI and executable streaming format will be part of the MiniZinc documentation.

@kalvdans

kalvdans commented Jul 8, 2026

Copy link
Copy Markdown

The documentation for the ABI and executable streaming format will be part of the MiniZinc documentation.

Great! Do you have a link to it?

@Dekker1

Dekker1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

You can have a look at the current draft in my fork: https://github.com/Dekker1/libminizinc/blob/feat/blackbox/docs/en/blackbox.rst

@kalvdans

kalvdans commented Jul 8, 2026

Copy link
Copy Markdown

You can have a look at the current draft in my fork: https://github.com/Dekker1/libminizinc/blob/feat/blackbox/docs/en/blackbox.rst

Thanks! Looks well documented. Perhaps mention whether fzn_blackbox function must be threadsafe, and there's a descrepancy who decides the number of output values; in the API it is the caller, in the streaming interface it is the black box.

@Dekker1

Dekker1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, I've updated the documentation with notes on these points. Regarding the seeming discrepancy, it should be noted that the fzn_blackbox constraint call always declares the amount of expected outputs, so if the stream contains a different amount of return values, this should generally be a runtime error.

@Dekker1

Dekker1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

I just pushed a small update to avoid an additional allocation for each propagate call (using int64_t directly) that I discovered working on the Chuffed implementation. This was a left-over from a previous version of the ABI where we used int. I'd updated the ABI connection, but not the internal run methods.

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