data-miningsolveror-toolsconstraint-programmingcp-sat

How to build my own global constraint with the CP-SAT solver of OR-tools?


I am a PhD candidate in data mininig, and I have to create a global constraint with OR-Tools for a data mining purpose.

The problem is that there is a lack of documentation about creating your own global constraint with CP-SAT, and I don't know how to start.


Solution

  • It is obviously possible, but very tedious, and very complex.

    Writing a new constraint implies:

    The last 3 items are extremely error prone, and very hard to debug, as the effect of cuts and explanations are delayed, and sometimes never used.

    For these reason, I recommend expanding the constraint into smaller ones. In fact, most of the CP constraints are expanded (alldiff, element, table, reservoir, inverse, automaton, some products, some modulos).

    You can also submit a feature request for a new constraint. It can happen if it is useful/general enough.

    Thanks