PyWraplp与CP-SAT有何不同?

发布于 2025-01-28 18:44:11 字数 261 浏览 4 评论 0原文

在Ortools中,如果您只有0-1变量,则可以使用CP-SAT

from ortools.sat.python import cp_model

,或者可以使用

from ortools.linear_solver import pywraplp
solver = pywraplp.Solver.CreateSolver('SAT')

这些求解器相同,如果没有,则有什么区别?

In ortools if you have only 0-1 variables you can either use CP-SAT from

from ortools.sat.python import cp_model

or you can use

from ortools.linear_solver import pywraplp
solver = pywraplp.Solver.CreateSolver('SAT')

Are these solvers the same and if not, what is the difference?

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

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

发布评论

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

评论(1

被翻牌 2025-02-04 18:44:11

PYWRAPLP支持具有浮点系数的线性方程/不等式。

CP-SAT仅是不可或缺的,但是除线性约束外,还支持更多的约束(二次调度,路由...)。
CP-SAT确实为物镜支持浮点系数。

带有SAT后端的Pywraplp缩放所有系数,以实现仅具有积分系数的线性约束,然后称为CP-SAT求解器。

Pywraplp supports linear equations/inequations with floating point coefficients.

CP-SAT is integral only, but support much more constraints (quadratic scheduling, routing...) in addition to linear constraints.
CP-SAT does support floating point coefficients for the objective.

pywraplp with the SAT backend scales all coefficients to achieve linear constraints that only have integral coefficients, then calls the CP-SAT solver.

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