如何检查Python中的定义约束?

发布于 2025-02-05 07:45:05 字数 445 浏览 3 评论 0原文

有什么方法可以检查模型并查看已定义了哪些约束?

例如, /or-tools/blob/stable/examples/python/sudoku_sat.py 定义以下内容:

# AllDifferent on rows.
for i in line:
    model.AddAllDifferent(grid[(i, j)] for j in line)

这是否在 model 中创建一些可观察的实体(例如,实体构成的数量)?

Is there any way to inspect model and see what constraints have been defined?

For instance, https://github.com/google/or-tools/blob/stable/examples/python/sudoku_sat.py defines the following:

# AllDifferent on rows.
for i in line:
    model.AddAllDifferent(grid[(i, j)] for j in line)

Does this create some observable entity in model (e.g. i number of entity-constraints)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁把谁当真 2025-02-12 07:45:07

您可以扫描基础CP_MODEL PROTOBUF。

请参阅model.proto()

You can scan the underlying cp_model protobuf.

see model.Proto()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文