【问题标题】:How to inspect defined constraints in python?如何检查python中定义的约束?
【发布时间】:2022-06-07 20:14:04
【问题描述】:

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

例如,https://github.com/google/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)

这是否会在模型(例如,我实体约束的数量)?

    标签: python constraints or-tools


    【解决方案1】:

    您可以扫描底层的 cp_model protobuf。

    见 model.Proto()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 2019-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多