Translating natural language into formal constraint models requires expertise in the problem domain and modeling frameworks. To investigate whether constraint modeling benefits from agentic workflows, we introduce CP-Agent, a Python coding agent using the ReAct framework with a persistent IPython kernel. Domain knowledge is provided through a project prompt of under 50 lines. The agent iteratively executes code, observes the solver's feedback, and refines models based on the execution results. We evaluate CP-Agent on CP-Bench's 101 constraint programming problems. We clarified the benchmark to address systematic ambiguities in problem specifications and errors in ground-truth models. On the clarified benchmark, CP-Agent solves all 101 problems. Ablation studies indicate that minimal guidance outperforms detailed procedural scaffolding, and that explicit task management tools have mixed effects on focused modeling tasks.
翻译:将自然语言转化为形式化的约束模型需要问题领域和建模框架方面的专业知识。为探究约束建模能否受益于智能体工作流,我们提出了CP-Agent——一个采用ReAct框架并依托持久化IPython内核的Python编码智能体。领域知识通过不超过50行的项目提示提供。该智能体迭代执行代码,观察求解器的反馈,并根据执行结果优化模型。我们在CP-Bench的101个约束规划问题上对CP-Agent进行评估。我们通过澄清基准测试,解决了问题描述中系统性的歧义以及基准真值模型中的错误。在澄清后的基准测试中,CP-Agent成功解决了全部101个问题。消融研究表明,最小化指导优于详细的过程性脚手架,而显式的任务管理工具对聚焦建模任务的影响则好坏参半。