为PyCSP3添加调度抽象,让建模更简洁高效。
PyCSP3-Scheduling: A Scheduling Extension for PyCSP3

- 新增53个调度专用约束和27个表达式,支持区间变量等抽象
- 编译后与原模型目标一致,8/17模型家族结构不变
- 部分场景提速达5.8倍,适合需要高效建模调度问题的用户
PyCSP³提供了一种高效构建组合约束问题模型的方法,并可导出至XCSP³,实现建模与求解的完全分离。但其缺乏对调度抽象(如区间变量、序列变量、资源函数)的原生支持,导致调度模型需用低级整数变量和手动通道约束编码,尽管已具备NoOverlap、Cumulative等全局约束。本文提出PyCSP³ Scheduling,通过53个专用约束和27个表达式扩展调度能力,将抽象编译为标准PyCSP³/XCSP³约束,保持建模-求解分离。在17个模型族共261对实例上测试(每组运行5次),所有72对双重证明最优解的目标值一致,8/17家族结构在编译后未改变;但运行时间因家族而异,部分提升最高达5.8倍,部分因编译分解开销出现退化。代码与基准数据见:https://github.com/sohaibafifi/pycsp3-scheduling
原文摘要 · Abstract (English)
PyCSP$^3$ provides a productive way to build constraint models for solving combinatorial constrained problems and export them to XCSP$^3$, preserving a complete separation between modeling and solving. However, it lacks native support for scheduling abstractions such as interval variables, sequence variables, and resource functions. As a result, scheduling models must be encoded with low-level integer variables and manual channeling constraints, even though PyCSP$^3$ already provides global constraints like NoOverlap and Cumulative on integer arrays. We present PyCSP$^3$ Scheduling, a library that adds scheduling abstractions to PyCSP$^3$ through 53 dedicated constraints and 27 expressions, and compiles them down to standard PyCSP$^3$/XCSP$^3$ constraints, maintaining the modeling/solving separation that underpins the PyCSP$^3$ ecosystem. On 261 paired instances across 17 model families (5 runs each), both formulations produce identical objectives on all 72 doubly-proved optimal pairs and nearly half of the families (8/17) remain structurally unchanged after compilation; however, runtime performance diverges across families, with clear gains on some (up to 5.8x) and regressions on others due to the overhead of compilation decompositions. Code and benchmarks are available at: https://github.com/sohaibafifi/pycsp3-scheduling
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。