Questions tagged [answer-set-programming]

Answer set programming is a declarative programming paradigm that can solve difficult search problems. It is based on the stable model (answer set) semantics of logic programming. Unlike traditional programming languages, we don’t give step by step instructions in answer set programming. It is something more like this is what I want, now you work out how to do it.

Answer set programming (ASP) is a declarative programming paradigm that can solve difficult search problems. It is based on the stable model (answer set) semantics of logic programming. Unlike traditional programming languages, we don’t give step by step instructions in answer set programming. It is something more like this is what I want, now you work out how to do it.

In answer set programming, if we can get the logic correct, ASP requires:

  • Orders of magnitude less code than imperative programming
  • Fewer points of failure
  • Less code to test
  • More productive (happier) programming life

traditional programming scheme

answer set programming scheme

161 questions
1
vote
1 answer

Solving a Logic Puzzle with Answer Set Programming

Disclaimer: I am almost entirely new to clingo, and answer set programming in general. I am trying to solve a grid logic puzzle using clingo. To start, I want to generate all models that include one instance of each category. For example, if there…
mattshin
  • 13
  • 1
  • 3
1
vote
1 answer

Counting the number of true predicates and limiting

Is there a specific way I can limit the number of true predicates available using a specified fact? At the moment I have total(2). as a fact. I thought this would work: :- total(N), #count{x:something_to_limit(x)} = K, K=N. However this doesn't…
Jared
  • 33
  • 1
  • 8
1
vote
1 answer

How to tell if a graph is strongly connected using answer set programming?

I'm new to answer set programming and could use some help. I've been reading this, but still could use some help. How would I use answer set programming to tell if a graph is strongly connected? My brainstorming: Graph represented by nodes and…
MoreFoam
  • 624
  • 1
  • 6
  • 25
1
vote
1 answer

DLV Rule is not safe

I am starting to work with DLV (Disjunctive Datalog) and I have a rule that is reporting a "Rule is not safe" error, when running the code. The rule is the following: foo(R, 1) :- not foo(R, _) I have read the manual and seen that "cyclic…
rutex
  • 137
  • 3
  • 12
1
vote
1 answer

Differences in optimization statement syntax (clingo 3 and clingo 4)

I have an optimization statement in a logic program, for clingo3: #minimize [ batteryFlat(mycar)=1, batteryFlat(yourcar)=1, hasNoFuel(mycar)=1, hasNoFuel(yourcar)=1, brokenIndicator(mycar)=1, brokenIndicator(yourcar)=1]. (Basically, I want the…
hassapikos
  • 59
  • 1
  • 2
  • 10
1
vote
1 answer

Tools for SAT grounding?

In ASP (Answer Set Programming), programs are written in a higher-level declarative language and then grounded in a deterministic way to generate an ASP instance using a grounder like lparse or gringo. Are there popular grounders the SAT community…
dspyz
  • 5,280
  • 2
  • 25
  • 63
1
vote
0 answers

Dynamically rewriting in ANTLR 3 n number of nodes from a list

I am using ANTLR 3 to parse and rewrite Answer-Set Programs (ASP). What I want to do is parse an ASP program and output an AST with some rewriting. I can easily add and remove nodes to/from the AST but what I need to do is add nodes to the root…
Dr. Thomas C. King
  • 993
  • 2
  • 15
  • 28
1
vote
1 answer

In Answer Set Programming, what is the difference between a model and a least model?

I'm taking an artificial intelligence class and we are working with Answer Set Programming (Clingo specifically). We're talking mostly theory at the moment and I am having some trouble differentiating between models and least models. I have the…
rphello101
  • 1,671
  • 5
  • 31
  • 59
1
vote
1 answer

Why DLV finds an answer set rather than another, in this ASP example program?

I tried two simple programs in ASP(Answer Set Programming) and then i used the answer set solver DLV to find the answer sets (also referred as stable models); the programs are P1: b :- c. c. P2: b :- c. f. in P1 dlv finds {c, b} as answer…
Giac1
  • 23
  • 6
1
vote
1 answer

Unexpected Result with Graphs in Clingo

I am trying to make a program in Clingo to solve a Euler path. So far this is what I have come up with. I want my graph to appear as follows. My input. edge(a,b). edge(b,c). edge(c,d). edge(d,e). edge(a,d). edge(b,d). …
WeldFire
  • 194
  • 1
  • 3
  • 8
1
vote
0 answers

Is Alloy an example of Answer Set Programming

I've been looking at ASP and am wondering about the relationship between these two approaches since they both use SATsolvers at the backend.although there is little or no overlap in the literature. I'd appreciate a simple comparision of the two.…
Chris Wallace
  • 495
  • 3
  • 11
1
vote
3 answers

Negation as failure in Prolog is a procedural behavior?

I have a little question about the negation as failure in Prolog language: This is a question more theoretical than practical because I have clear how this example work. so I have the following Prolog program: /* Fatti che specificano quali esseri…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
0
votes
0 answers

Clingo: Ask clingo to maximise first rule before other rules

I have a clingo program that comes with multiple soft constraints distributed by different weight. maximize {1@100, X: constraint1(X)}. minimize {1@70, X: constraint2(X)}. . . . minimize {1@1, X: constraintK(X)}. As the program runs, the optimiser…
ILoveET
  • 109
  • 1
  • 6
0
votes
1 answer

How to make a simple game simulation in clingo?

I’m new to clingo (answer set programming) and I’m stuck with a very simple problem. I want to simulate a very simple behaviour: A game board with two rows and three columns, and three tokens, placed on the first row. As if they were chess pawns,…
Marc
  • 101
  • 2
  • 4
0
votes
0 answers

How to use optional fields in clingo

I want to use a graph structure in python and translate it to clingo and I have a perfectly good idea on how to to establish the edges and the nodes, partly thanks to this post: How to tell if a graph is strongly connected using answer set…