custom constraint or-tools

607 views
Skip to first unread message

Nassim Bb

unread,
Dec 11, 2018, 4:50:55 AM12/11/18
to or-tools-discuss
Hello , 
I am a Phd student and i would like to create my own global constraint using or-tools , can you please refer me to some documentations on how to do it since the one that exist does not provide much information on how to do it. By the way my constraint is for itemset mining.
Thank you 
Nassim

Laurent Perron

unread,
Dec 11, 2018, 4:58:58 AM12/11/18
to or-tools-discuss
Look at ortools/constraint_solver/constraint_solver.i and makefiles/Makefile.python.mk

and of course swig.org

Please note this is a nightmare.

--Laurent

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
--Laurent

Nassim Bb

unread,
Dec 11, 2018, 5:07:14 AM12/11/18
to or-tools...@googlegroups.com
Thank you for your help 

Laurent Perron

unread,
Dec 11, 2018, 5:27:28 AM12/11/18
to or-tools-discuss
I assumed you wanted to use the original constraint solver (ortools/constraint_solver).

We do recommend using the new CP-SAT solver (ortools/sat/cp_model.h).

The only (big) downside is that you cannot write new constraints with this solver.

Nassim Bb

unread,
Dec 11, 2018, 5:29:53 AM12/11/18
to or-tools...@googlegroups.com
Actually i only want to create a custom constraint for filtering, you told me there is an example in  or-tools/examples/cpp/dobble_ls.cc 

Yahia Lebbah

unread,
Dec 11, 2018, 5:32:40 AM12/11/18
to or-tools...@googlegroups.com

But, adding new constraints, is an essences of CP. Don't understand why such key feature is omitted ...
Anyway, is the old original constraint solver (where we can added propagators) still maintained ?

Best regards,

Yahia Lebbah

Laurent Perron

unread,
Dec 11, 2018, 5:43:18 AM12/11/18
to or-tools-discuss
Yes, it is still maintained. But we will not work on it to improve performance, except for the routing library.

The essence of CP is to solve problems with a high level modeling language.
We can add new constraints to the CP-SAT solver, it is just too complex, and there are no tools to debug them :-)

J. E. Marca

unread,
Dec 11, 2018, 11:18:33 AM12/11/18
to or-tools...@googlegroups.com
Is the lack of tools to debug constraints a PhD level problem, or is it just a programming cleverness level problem?

Laurent Perron

unread,
Dec 11, 2018, 11:26:12 AM12/11/18
to or-tools-discuss
PhD level, when writing a constraint for the CP-SAT solver, you need to explain all propagation.
The key to performance it to write a minimal explanation.

The problem is that if the explanation is wrong, the effect may be visible much later during search. You may find a optimal value too optimal, or not enough...
As everything is delayed, it is hard to poinpoint the culprit code.
Reply all
Reply to author
Forward
0 new messages