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
0
votes
2 answers

create subset and use each atom only once

I am totally new in asp. I need to create a group of teams. Each group must consist of 3 randomly chosen teams. A team can be in only one group. Thanks in advance. Here is my code team(fener;galata;besik;van;adana;mardin). neq(X,Y) :-…
Ismail Sahin
  • 2,640
  • 5
  • 31
  • 58
0
votes
1 answer

Checking intersection between two rectangles in answer set programming

The rule below checks for intersection. :- areaCoords(X1,Y1,X2,Y2), areaCoords(XA,YA,XB,YB), XA >= X1, X2 >= XA, YB >= Y1, Y2 >= YA, (X1,Y1,X2,Y2) != (XA,YA,XB,YB). However it generates symmetric pairs. That is, it checks for intersection(A,B) and…
Cihan
  • 175
  • 1
  • 3
  • 14
0
votes
1 answer

Problems when running an ASP program from a Java program using Runtime.exec()

So the problem that I am having is that I can't get a ASP program to execute fully when run using a bash script. So the script runs the ASP but only starts, it never completes. So my question is how to make clingo fully execute when using bash bash…
0
votes
1 answer

Attempting two-way communication between Python2.7 and ASP: writing contents of named pipe to a text file not working

I'm using Python2.7, the SPARC ASP solver, and am running my code from the Ubuntu14.04 command line. I'm trying to set up two-way communication between my Python code and my ASP (answer-set-programming) code. To do this I am sending queries from…
0
votes
2 answers

How do I use output from SPARC solver as input to a python file?

My question: I need to save the output from a SPARC solver (which is currently appearing as text in the terminal) as a variable in my Python code. How can I do this? Quick note: SPARC is a solver used for ASP (answer-set-programming) files - just…
0
votes
1 answer

asp (clingo) : why are ordered sums not working

Consider the followig code, compiled in clingo. File test.lp. Compile command: clingo 0 test.lp. col(("rot";"blau")). freq("rot","hell",2). freq("rot","dunkel",2). freq("rot","hell",5). freq("blau","hell",20). freq("blau","dunkel",30).…
Thomas
  • 175
  • 11
0
votes
1 answer

ASP Clingo - splitting graph to n cliques

For a given graph i need to represent it using at most n cliques. I have problem with this task. This is similar to n-coloring of graph which is opposite of given graph (Graph b is opposite of graph A when if edge(a, b) in graph A than edge(a, b)…
domandinho
  • 1,260
  • 2
  • 16
  • 29
0
votes
1 answer

Use Clingo 4.5 with Gringo 3

I am trying to run the code from the exercises from Chapter 8 of the PCGBook. They use clingo but don't say what version they are using. When I downloaded the latest version of Clingo from Potassco's sourceforge (version 4.5.4), it gives me lexer…
nightwuffle
  • 311
  • 3
  • 10
0
votes
1 answer

DLV list composition

I was wondering if there is a way in DLV for creating a list with the elements of all predicates that are true in a rule. For example, if I have the following predicates foo(a, b). foo(a, c). foo(a, e). foo(b, c). The result I am looking for should…
rutex
  • 137
  • 3
  • 12
0
votes
1 answer

DLV interactive mode (debugging)

I have been working on DLV for a little while and when the program is big I find it difficult to follow the activation of rules. So I went to the manual and checked if there was something to allow me to do this. The only thing I found was the…
rutex
  • 137
  • 3
  • 12
0
votes
0 answers

answer set programming "Guesses"

I want to pick exactly "steps" item from the guess block however I got unsat when I limit the guess with cardinalities. % Pick a series of move %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% steps { vpr(X,Y) :…
Cihan
  • 175
  • 1
  • 3
  • 14
0
votes
1 answer

Packing Squares into A Rectangle, Using Constraints (CLINGO)

Use CLINGO to pack a given set of squares into a given rectangular area without overlaps. For example, we want to pack the squares: A of size 4, B of size 3, C & D of size 2, E of size 1 into an area 5 x 8. #const x = 8. #const y =…
1010101
  • 51
  • 1
  • 1
  • 4
0
votes
1 answer

Answer Set Programming: Group into two sets so that those who like each other are in same set, and dislike = different set

I'm basically a beginner to Answer Set Programming (CLINGO), so I've been attempting this problem for hours now. person(a;b;c;d;e;f). likes(b,e; d,f). dislikes(a,b; c,e). People who like each other must be in the same set, and cannot be in the same…
1010101
  • 51
  • 1
  • 1
  • 4
0
votes
1 answer

Answer Set Programming #Count cardinality constraint

I'm a complete beginner at ASP. adj(c11,c12). adj(c12,c13). adj(c13,c14). adj(c21,c22). adj(c22,c23). adj(c23,c24). adj(c31,c32). adj(c32,c33). adj(c33,c34). adj(c11,c21). adj(c12,c22). adj(c13,c23). adj(c14,c24). adj(c21,c31). adj(c22,c32).…
Martin Dawson
  • 7,455
  • 6
  • 49
  • 92
0
votes
0 answers

Mapping predicates and propositions in DLV/Prolog

I'm having trouble understanding how to go about something Imagine i have 3 donkeys, and each donkey has a favorite cloth, and plays at its favorite playground. If i give these donkeys constraints on which playground could be its favorite playground…
1 2 3
10
11