[英]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 ORtools for a data mining purpose.我是数据挖掘的博士候选人,我必须使用 ORtools 创建一个全局约束以用于数据挖掘目的。
The problem is that there is a lack of documentation about creating your own global constraint with CP-Sat in the inte.net, and i don't know how to start.问题是在 inte.net 中缺少关于使用 CP-Sat 创建您自己的全局约束的文档,我不知道如何开始。
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.最后 3 项极易出错,并且很难调试,因为剪辑和解释的效果会延迟,有时甚至根本不会使用。
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).事实上,大部分CP约束都是展开的(alldiff、element、table、reservoir、inverse、automaton、一些乘积、一些模数)。
You can also submit a feature request for a new constraint.您还可以提交新约束的功能请求。 It can happen if it is useful/general enough.如果它足够有用/足够通用,它就会发生。
Thanks谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.