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

Search space difference between clingo and multishot solving clingo

I am new to the area of ASP. I would like to know whether multi-shot solving will affect the overall search space, more than the classical one. Also, does the search space of the following program relies only on the choice rules? a:-b. {b}. what…
0
votes
1 answer

in clingo can I head start my optimization with an existing suboptimal answer set?

I want to run a clingo program containing an optimization. I already have a (suboptimal) model. Is there a way to "help" clingo with the existing model? I'm using the python api. Minimal example (n queens, but minimize the sum of the product of the…
DuDa
  • 3,718
  • 4
  • 16
  • 36
0
votes
1 answer

Clingo ASP - Define a sequence to be a permutation of a given set

I am continuing my journey from here. I am trying to learn ASP and working on a project like this: Find the sequence s = (s1, s2, ..., sn) with the following properties: s is a permutation of the set {0, 1, ..., n-1}; the sequence v = (|s2-s1|,…
nooblet2
  • 31
  • 6
0
votes
0 answers

Extract tree from a directed cyclic graph in answer set programming

I am trying to generate all paths between two nodes, where each edge can only be visited once. Here is my ASP code: % Define the input: nodes and edges node(a). node(b). node(c). node(d). edge(a,b). edge(b,c). edge(c,d),edge(d,a). % Define the…
0
votes
0 answers

Clingo ASP - Permutation of a list and absolute differences of its elements

I am trying to learn and understand Answer Set Programming with Clingo (https://potassco.org/clingo/run/). Here is a task I am struggling with now: Find the sequence s = (s1, s2, ..., sn) with the following properties: s is a permutation of the set…
nooblet2
  • 31
  • 6
0
votes
0 answers

A question about the inner workings of ASP

I'm confused about the inner workings of ASP. Say I'm modelling a country's. For example, say we have city(london). city(manchester). city(leeds). city(newcastle). city(sheffield). road(a1). road(b1). connects(a1, london,sheffield). connects(b1,…
0
votes
2 answers

How can I take an arbitrary input as a variable in clingo(Answer set programming)?

For example, I input four node: node(a). node(b). node(c). node(d). Without no hard-code, how can I pick an arbitrary input as a variable. I set a root(A) I want root(A) equal to node(a)
0
votes
1 answer

How to disply answer sets without facts

Please, can someone tell me how to display all the resulted answer sets in a logic program compiled with Clingo , without displaying the facts, i need to see only rules without facts.
0
votes
1 answer

Clingo: Intersecting All Possible Optimal Solutions (ASP)

I want to find atoms, within a pre-defined set of atoms, that are in all possible optimal solutions of an ASP problem. I'll explain what i want to do. I have an optimization problem where multiple optimal answer sets can exist. An answer set…
0
votes
1 answer

Clingo ASP - Exchange Coin Problem How to sum the same numbers

Thats my task: We have coins: 1 cent, 2 cents, 5 cents, 10 cents, 20 cents, 50 cents, 1 dollar and 2 dollars. How many ways can you get 2 dollars using anynumber of coins? I accualy ended up with something like this: coins(a,1; b,2; c,5; d,10;…
Heaglock
  • 1
  • 1
0
votes
1 answer

remove a sub set from set in Clingo

I am new to Clingo and encountered a situation where I needed to remove a subset from the answer set. For example, I have p(1..9). and I want to remove p(5) from my answer set. How can I do it? Without creating a new answer set? Consider that I have…
Ali Ghazi
  • 45
  • 7
0
votes
1 answer

how to input clingo variable

I have following code, but I want to change the variable of p, how can I do it? {p(1;2;3;4)}. :- p(X*2). It is normal. But the following code does'nt work. p(1;2;3;4) {p(X)} :- X = p(X). :- p(X*2).
Reason
  • 1
0
votes
1 answer

clingo return the max subset

I have the following code: 1{p(1..10)}10. :- p(I*2). and it shows 31 answers, But I just need the max subset p(1) p(3) p(5) p(7) p(9). How can I do it?
Reason
  • 1
0
votes
1 answer

Calendar of a football championship - Answer set programming

I wrote an algorithm in answer set programming, run with clingo, to calculate a league of 20 teams and its 38 matches (19 round and 19 return) with certain constraints: There may not be more than one match on the same day with two teams at home…
BlowLore
  • 83
  • 3
  • 11
0
votes
1 answer

How to write constraint involving a certain parameter in clingo?

I am attempting to solve the Google ASP Competition 2019 : Insurance Referee Assignment problem. The problem is provided in this link. There is a hard constraint that if a referee has preference type of 0 then the case will not be assigned to that…
user11665646