除了设计自己的算法,这是一个数学模型查找任务。对于此任务,我特别推荐
mace4
,它是
LADR 库 的一部分。它专门针对像这样的代数问题进行调整。输入文件(让我们称其为
semigroups.in
)如下:
formulas(sos).
(x * y) * z = x * (y * z).
end_of_list.
然后通过运行mace4 -n 4 -N 4 -m 10000 <semigroup.in
(查找所有4元模型并打印其中的前10000个)会产生类似下面的长输出,涉及IT技术相关内容。
...
============================== MODEL =================================
interpretation( 4, [number=2331, seconds=0], [
function(*(_,_), [
1, 2, 3, 3,
2, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3 ])
]).
============================== end of model ==========================
============================== STATISTICS ============================
For domain size 4.
Current CPU time: 0.00 seconds (total CPU time: 0.11 seconds).
Ground clauses: seen=64, kept=64.
Selections=2132, assignments=8520, propagations=6194, current_models=2331.
Rewrite_terms=210696, rewrite_bools=65151, indexes=11452.
Rules_from_neg_clauses=586, cross_offs=3767.
============================== end of statistics =====================
User_CPU=0.11, System_CPU=0.26, Wall_clock=0.
Exiting with 2331 models.
正如您所见,它非常快速。
该库包含许多其他工具,例如 isofilter
,可让您过滤代数的同构变体等。
O(n^(n^2))
的复杂度),但并不是关于组合数学的。我认为这篇文章可能更适合 程序员SE,因为他们在 他们的FAQ 中明确提到了算法。 - bheklilr