the answer什么意思 to the q...

From Wikipedia, the free encyclopedia
Answer set programming (ASP) is a form of
oriented towards difficult (primarily ) . It is based on the
(answer set) semantics of . In ASP, search problems are reduced to computing stable models, and answer set solvers — programs for generating stable models—are used to perform search. The computational process employed in the design of many answer set solvers is an enhancement of the
and, in principle, it always terminates (unlike
query evaluation, which may lead to an ).
In a more general sense, ASP includes all applications of answer sets to
and the use of Prolog-style query evaluation for solving problems arising in these applications.
method proposed in 1993 by Dimopoulos, Nebel and K?hler is an early example of answer set programming. Their approach is based on the relationship between plans and stable models. Soininen and Niemel? applied what is now known as answer set programming to the problem of product configuration. The use of answer set solvers for search was identified as a new programming paradigm by Marek and Truszczyński in a paper that appeared in a 25-year perspective on the logic programming paradigm published in 1999
and in [Niemel? 1999]. Indeed, the new terminology of "answer set" instead of "stable model" was first proposed by Lifschitz in a paper appearing in the same retrospective volume as the Marek-Truszczynski paper.
is the name of the program that was originally created as grounding tool (front-end) for the answer set solver . The language that Lparse accepts is now commonly called AnsProlog*, short for Answer Set Programming in Logic. It is now used in the same way in many other answer set solvers, including , , , ,
and . ( the syntax of ASP programs written for dlv is somewhat different.)
An AnsProlog program consists of rules of the form
&head& :- &body& .
The symbol :- ("if") is dropped if &body& such rules are called facts. The simplest kind of Lparse rules are .
One other useful construct included in this language is choice. For instance, the choice rule
says: choose arbitrarily which of the atoms
to include in the stable model. The lparse program that contains this choice rule and no other rules has 8 stable models—arbitrary subsets of . The definition of a stable model was generalized to programs with choice rules. Choice rules can be treated also as abbreviations for . For instance, the choice rule above can be viewed as shorthand for the conjunction of three "" formulas:
The language of lparse allows us also to write "constrained" choice rules, such as
1{p,q,r}2.
This rule says: choose at least 1 of the atoms , but not more than 2. The meaning of this rule under the stable model semantics is represented by the
Cardinality bounds can be used in the body of a rule as well, for instance:
:- 2{p,q,r}.
Adding this constraint to an Lparse program eliminates the stable models that contain at least 2 of the atoms . The meaning of this rule can be represented by the propositional formula
Variables (capitalized, as in ) are used in Lparse to abbreviate collections of rules that follow the same pattern, and also to abbreviate collections of atoms within the same rule. For instance, the Lparse program
p(a). p(b). p(c).
q(X) :- p(X), X!=a.
has the same meaning as
p(a). p(b). p(c).
q(b). q(c).
The program
p(a). p(b). p(c).
{q(X):-p(X)}2.
is shorthand for
p(a). p(b). p(c).
{q(a),q(b),q(c)}2.
A range is of the form:
&Predicate&(start..end)
where start and end are constant valued arithmetic expressions. A range is a notational shortcut that is mainly used to define numerical domains in a compatible way. For example, the fact
is a shortcut for
a(1). a(2). a(3).
Ranges can also be used in rule bodies with the same semantics.
A conditional literal is of the form:
If the extension of q is {q(a1); q(a2); ... ; q(aN)}, the above condition is semantically equivalent to writing p(a1), p(a2), ... , p(aN) in the place of the condition. For example
a :- 1 {p(X):q(X)}.
is a shorthand for
q(1). q(2).
a :- 1 {p(1), p(2)}.
To find a stable model of the Lparse program stored in file &filename& we use the command
% lparse &filename& | smodels
Option 0 instructs smodels to find all stable models of the program. For instance, if file test contains the rules
1{p,q,r}2.
s :- not p.
then the command
% lparse test | smodels 0
produces the output
Stable Model: q p
Stable Model: p
Stable Model: r p
Stable Model: q s
Stable Model: r s
Stable Model: r q s
is a function
from its set of vertices to
for every pair of adjacent vertices . We would like to use ASP to find an -coloring of a given graph (or determine that it does not exist).
This can be accomplished using the following Lparse program:
1 {color(X,I) : c(I)} 1 :- v(X).
:- color(X,I), color(Y,I), e(X,Y), c(I).
Line 1 defines the numbers
to be colors. According to the choice rule in Line 2, a unique color
should be assigned to each vertex . The constraint in Line 3 prohibits assigning the same color to vertices
if there is an edge connecting them.
If we combine this file with a definition of , such as
v(1..100). % 1,...,100 are vertices
e(1,55). % there is an edge from 1 to 55
and run smodels on it, with the numeric value of
specified on the command line, then the atoms of the form
in the output of smodels will represent an -coloring of .
The program in this example illustrates the "generate-and-test" organization that is often found in simple ASP programs. The choice rule describes a set of "potential solutions" — a simple superset of the set of solutions to the given search problem. It is followed by a constraint, which eliminates all potential solutions that are not acceptable. However, the search process employed by smodels and other answer set solvers is not based on .
in a graph is a set of pairwise adjacent vertices. The following lparse program finds a clique of size
in a given graph, or determines that it does not exist:
n {in(X) : v(X)}.
:- in(X), in(Y), v(X), v(Y), X!=Y, not e(X,Y), not e(Y,X).
This is another example of the generate-and-test organization. The choice rule in Line 1 "generates" all sets consisting of
vertices. The constraint in Line 2 "weeds out" the sets that are not cliques.
that passes through each vertex of the graph exactly once. The following Lparse program can be used to find a Hamiltonian cycle in a given directe we assume that 0 is one of the vertices.
{in(X,Y)} :- e(X,Y).
:- 2 {in(X,Y) : e(X,Y)}, v(X).
:- 2 {in(X,Y) : e(X,Y)}, v(Y).
r(X) :- in(0,X), v(X).
r(Y) :- r(X), in(X,Y), e(X,Y).
:- not r(X), v(X).
The choice rule in Line 1 "generates" all subsets of the set of edges. The three constraints "weed out" the subsets that are not Hamiltonian cycles. The last of them uses the auxiliary predicate
(" is reachable from 0") to prohibit the vertices that do not satisfy this condition. This predicate is defined recursively in Lines 4 and 5.
This program is an example of the more general "generate, define and test" organization: it includes the definition of an auxiliary predicate that helps us eliminate all "bad" potential solutions.
Early systems, such as Smodels, used backtracking to find solutions. As the theory and practice of
evolved, a number of ASP solvers were built on top of SAT solvers, including ASSAT and Cmodels. These converted ASP formula into SAT propositions, applied the SAT solver, and then converted the solutions back to ASP form. More recent systems, such as Clasp, use a hybrid approach, using conflict-driven algorithms inspired by SAT, without full converting into a boolean-logic form. These approaches allow for significant improvements of performance, often by an order of magnitude, over earlier backtracking algorithms.
project acts as an umbrella for many of the systems below, including clasp, grounding systems (gringo), incremental systems (iclingo), constraint solvers (clingcon),
to ASP compilers (coala), distributed MPI implementations (claspar), and many others.
Most systems support variables, but only indirectly, by forcing grounding, by using a grounding system such as Lparse or gringo as a front end. The need for grounding can cause a combinatorial
thus, systems that perform on-the-fly grounding might have an advantage.
Function symbols
Explicit sets
Explicit lists
Disjunctive (choice rules) support
on-the-fly grounding
SAT-solver based
Yes, in Clingo
incremental, SAT-solver inspired (nogood, conflict-driven)
Requires grounding
incremental, SAT-solver inspired (nogood, conflict-driven)
free for academic and non-commercial educational use, and for non-profit organizations
not Lparse compatible
built on top of
— not Lparse compatible
Requires grounding
built on top of smodels
combined literal+rule-based
distributed, multi-threaded nomore++, smodels
solver based
Requires grounding
Requires grounding
SAT- smodels w/conflict clauses
SAT-solver based
Baral, Chitta (2003). . Cambridge University Press.  .
Gelfond, Michael (2008). "Answer sets". In van Harmelen, F Lifschitz, V Porter, Bruce. . Elsevier. pp. 285–316.  .
Dimopoulos, Y.; ; K?hler, J. (1997). "Encoding planning problems in non-monotonic logic programs". In Steel, S Alami, Rachid. . Lecture notes in computer science: Lecture notes in artificial intelligence 1348. Springer. pp. 273–285.  .
Subrahmanian, V.S.; Zaniolo, C. (1995). . In Sterling, Leon. Logic Programming: Proceedings of the Twelfth International Conference on Logic Programming. MIT Press. pp. 233–247.  .
Soininen, T.; Niemel?, I. (1998),
(Postscript) (TKO-B142), Laboratory of Information Processing Science, Helsinki University of Technology
Marek, V.; Truszczyński, M. (1999). . In Apt, Krzysztof R.
(PDF). Springer. pp. 169–181.  .
Niemel?, I. (1999).
(Postscript,gzipped). Annals of Mathematics and Artificial Intelligence 25: 241–273. :.
Lifschitz, V. (1999). "Action Languages, Answer Sets, and Planning". In , pp. 357–374
Crick, Tom (2009).
(Ph.D.). University of Bath. Docket 20352.
Rogelio Davila.
(PowerPoint).
Niemel?, I.; Simons, P.; Soinenen, T. (2000). . In Gelfond, M Leone, N Pfeifer, Gerald. Logic Programming and Nonmonotonic Reasoning: 5th International Conference, LPNMR '99, El Paso, Texas, USA, December 2–4, 1999 Proceedings. Lecture notes in computer science: Lecture notes in artificial intelligence 1730. Springer. pp. 317–331.  .
Ferraris, P.; Lifschitz, V. (January 2005).
(PDF). Theory and Practice of Logic Programming 5 (1-2): 45–74. :.
. DLVSYSTEM s.r.l 2011.
: Hidden categories:您还未登陆,请登录后操作!
Write the facts you need to answer the
Write the facts you need to answer the
question中的you need to answer the
question是否修饰FACTS,FACTS在从句嘚位置应是you need
FACTS to answer the
question,请译一下
写下你用来支持自己对此问题答案的论点
回答数:23
您的举报已经提交成功,我们将尽快处理,谢谢!

我要回帖

更多关于 the answer什么意思 的文章

 

随机推荐