I am working on a geometry problem with the OR-Tools constraint programming tools.
Could one of you tell me the procedure to create a custom constraint? I dont really understand demon, model visitor behavior...
Also, can any type of constraint be inserted?
Thank you in advance
To write a constraint, you need to understand that during search, variables are not instantiated (domain is reduced to a single value). Therefore, calling Value() does not work.
You can access the current domain (min, max, list of possible values, and then you can write deduction rule from there).
See https://github.com/google/or-tools/blob/stable/examples/cpp/dobble_ls.cc.
Now, the CP solver is replaced by the CP-SAT solver, which does not allow writing custom constraints. In that case, maybe you can express you constraints with boolean logic, and arithmetic operators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With