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
6
votes
3 answers

How to understand negation as failure in ASP?

Suppose we have the following program: human(socrates). day(tomorrow). die(X) :- human(X). may_go_to_school(Y) :- day(Y), not holiday(Y). If we run clingo to aquire the answer set of the program, we get Answer:…
BobHU
  • 402
  • 5
  • 18
5
votes
0 answers

Clingo answer set programming newbie

I got the following answer set programming problem but not sure if my answer is correct: A(X) are normally E(X) U(X) are normally not E(X) G(X) are normally E(X) Every G(X) is U(X) U(X) are normally A(X) G(t1) G(t2) and not E(t2) U(t3) The…
Matt
  • 739
  • 2
  • 6
  • 10
4
votes
1 answer

Prolog/ASP(Clingo) to CLIPS translater

Is there any easy way to translate a Prolog/ASP code into CLIPS? Something like this one, but with CLIPS instead of Prover9: https://github.com/potassco/anthem/tree/master/examples
ciurlaro
  • 742
  • 10
  • 22
4
votes
4 answers

How should list be represented in ASP (Answer Set Programming)?

A processor 'a' takes care the header 'a' of a message 'a_b_c_d' and passes the payload 'b_c_d' to the another processor in the next level as following: msg(a, b_c_d). pro(a;b;c;d). msg(b, c_d) :- pro(X), msg(X, b_c_d). msg(c, d) :- pro(X),…
tak-po li
  • 85
  • 4
3
votes
1 answer

N-Queens problem using answer set programming

trying to learn answer set programming and decided to give the n-queens problem a go. This is what I have so far:- % Queens are placed on an n x n chess board. % Each queens must not attack each other. % Represent the chess board…
3
votes
1 answer

What's the difference between logic programming and answer set programming

I'm currently learning how to prove the unsatisfiability of first-order logic. I've learnd in my class that resolution is one way to solve the unsatisfiability problem, e.g., tools like Prolog achieve this by implementing SLDNF resolution to try to…
Li Danyuan
  • 121
  • 8
3
votes
2 answers

Gather all answer sets into one answer set (ASP)

my question is, if I can gather all answer sets into one answer. I attach the code below for my program. The results that it returns and a description of what I would like to have. % Main domain predicates…
3
votes
1 answer

How to use data structures instead of command line arguments with clingo - (ASP)

I am starting off with logical programming, and I am working on a simple program to find shortest paths between nodes. The only tutorial I could really understand dealt with command arguments. Is there a way I can replace Args in my program for a…
3
votes
2 answers

ASP Hamiltonian Cycle Story

Hello I am new to answer-set-programming. I have done a little prolog in the past! I am trying to solve this problem I believe it can be solved with hamiltonian-cycle, let me know your opinion. If you are not familiar with ASP you can visit this…
3
votes
2 answers

Clingo - Progression error/warning

I'm running the solver on a planning and between the various answer sets i get what I think is a warning (as it does not termiate the execution) saying the following: Progression : [2;8] (Error: 3) Progression : [3;8] (Error: 1.66667) Progression :…
valent0ne
  • 139
  • 1
  • 2
  • 10
3
votes
1 answer

Prolog - ASP 'not' to Prolog negate

I have an example problem in Answer Set Programming (ASP). When I try to make the equivalent code in Prolog, I keep getting stuck with the not blocked. This is the ASP…
3
votes
1 answer

Count Aggregates in clingo

Test data addEmployee(EmplID, Name1, Name2, TypeOfWork, Salary, TxnDate) addEmployee("tjb1998", "eva", "mcdowell", "ra", 55000, 20). addEmployee("tjb1987x", "ben", "xena", "cdt", 68000, q50). addEmployee("tjb2112", "ryoko", "hakubi", "ra", 63000,…
kjosh
  • 158
  • 2
  • 13
3
votes
1 answer

Clingo: create custom function

I am at wit's end as to create a "function" in clingo, if such can be defined. In a simplified version of what I am trying to accomplish, I wrote this very short program: a(1..3). adj(X,Y) :- a(X), a(Y), abs(X-Y)==1. #hide a/1. Basically, I want…
Andrea Aloi
  • 971
  • 1
  • 17
  • 37
2
votes
1 answer

Calculating the distance between two nodes in a directed Graph

I'm currently learning answer set programming with clingo and I'm really struggling with calculating the distance between nodes in a directed graph. I would know how to hardcode it for every distance but that's no real way to do it. I currently have…
Chrizzoh
  • 35
  • 5
2
votes
1 answer

Only compute/solve a specific rule in clingo

Warning: ASP newbie. Let's assume we have this simple program: % crime scene % Facts present(harry). % was present on the crime scene present(sally). present(mary). motive(harry). % has a motive motive(sally). guilty(harry). % encoding /…
Geneviève M.
  • 240
  • 1
  • 9
1
2 3
10 11