当自然变量不足时:用数独教授整数规划
When Natural Variables Are Not Enough: Teaching Integer Programming with Sudoku
AI总结:
本文通过数独问题比较两种整数线性规划建模方法,指出自然变量(单元格整数值)需要大量大M约束实现全异约束,而二元赋值变量更简洁高效,并给出AMPL代码及唯一性验证。
摘要:
数独是一个紧凑且熟悉的场景,用于教授整数线性规划中一个令人惊讶的深刻教训,即最自然的决策变量并不总是足以产生有效或方便的线性模型。本文比较了数独的两种公式化表述。第一种使用二元赋值变量,指示特定数字是否分配给特定单元格。从谜题棋盘本身的角度来看,这种表述不太自然,但它通过简单的赋值约束编码了谜题规则,并容易扩展到杀手数独等变体。第二种表述使用更自然的方法,即分配一个整数变量来表示每个单元格中的值,但核心要求是每行、每列和每块中的值必须全部不同。当必须使用线性约束表达这种全异要求同时保留单元格值变量时,该公式化表述变成了一大堆通过大M不等式线性化的成对析取约束。本文包含了赋值模型和自然全异模型的AMPL代码,并推导了用于验证唯一性的第二个整数规划。本文还将广义数独作为计算复杂性的谨慎切入点,同时强调标准九乘九谜题本身并非渐近问题类。
英文摘要:
Sudoku is a compact and familiar setting for teaching a surprisingly deep lesson in integer linear programming, namely that the most natural decision variables are not always enough to produce an effective or convenient linear model. This paper compares two formulations of Sudoku. The first uses binary assignment variables indicating whether a particular digit is assigned to a particular cell. This formulation is less natural from the perspective of the puzzle board itself, but it encodes the puzzle rules through simple assignment constraints and extends easily to variants such as Killer Sudoku. The second formulation uses the more natural approach of assigning one integer variable to represent the value in each cell, but then the central requirement is that the values in each row, column, and block must be all different. When this all-different requirement must be expressed using linear constraints while retaining the cell-value variables, the formulation becomes a large collection of pairwise disjunctions linearised by big-M inequalities. The paper includes AMPL code for both the assignment model and the natural all-different model, and derives a second integer program for certifying uniqueness. The paper also uses generalised Sudoku as a careful entry point to computational complexity, while emphasising that the standard nine-by-nine puzzle is not itself an asymptotic problem class.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。