搜索“ASP solver”可以得到若干个,clasp是其中一个http://www.cs.uni-potsdam.de/clasp/?page=main

有本教程叫A User's Guide to gringo, clasp, clingo, and iclingo,Google一下就可以下到

Answer Set Programming的优点在于,你只需要定义规则,求解的方法由ASP solver来解决,这是一种declarative language,和SQL同类

 看如下这个数独(http://www.sudoku.name/index-cn.php):

用Answer Set Programming解数独

首先描述facts(文件sudoku_fact.lp):

row(1..9).
col(1..9).
value(1..9).
put(1,2,9).
put(1,4,7).
put(1,6,6).
put(1,7,1).

put(2,2,2).
put(2,3,5).
put(2,4,3).
put(2,8,6).
put(2,9,7).

put(3,3,6).
put(3,5,2).
put(3,8,8).

put(4,1,5).
put(4,6,9).
put(4,7,3).

put(5,1,7).
put(5,3,3).
put(5,5,4).
put(5,7,2).
put(5,9,8).

put(6,3,8).
put(6,5,3).
put(6,6,7).
put(6,9,6).

put(7,2,8).
put(7,5,5).
put(7,7,6).

put(8,1,4).
put(8,2,3).
put(8,6,8).
put(8,7,7).
put(8,8,2).

put(9,3,9).
put(9,4,1).
put(9,6,2).
put(9,8,3).
View Code

相关文章:

  • 2021-12-24
  • 2021-04-11
  • 2022-12-23
  • 2021-12-09
  • 2021-06-17
  • 2022-12-23
  • 2021-12-24
  • 2021-08-21
猜你喜欢
  • 2021-08-24
  • 2022-12-23
  • 2021-10-24
  • 2021-07-30
  • 2021-09-17
  • 2021-05-26
  • 2022-12-23
相关资源
相似解决方案