Questions tagged [clingo]

Questions related to the clingo system of the potassco suite.

The clingo system of the potassco suite. https://potassco.org/

Related tags:

155 questions
1
vote
1 answer

Detecting even cycles in a directed graph using answer set programming (clingo)?

I struggled a bit with that task. But I want to know, how I can detect if there is an even cycle in a directed graph using answer set programming with clingo. If there is an even cycle, the program should return satisfiable, if there is no even…
LuxLaw
  • 13
  • 3
1
vote
1 answer

Shortest path in Answer Set Programming

I'm trying to find all the shortest path from one source node to all other destination node (so 1-3, 1-5, 1-4) with the relative cost for each shortest path. I've tried with this…
1
vote
1 answer

Solving Hamiltonian cycle in answer set programming

Hamiltonian cycle instantiation and encoding: % vertices: n=node n(1..4). % edges: e=edge e(1,(2;3)). e(2,(3;4)). e(3,(1;4)). e(4,1). % starting point s(1). # p=path, o=omit, op=on-path, r=reach, s=start% generate path p(X,Y):- not o(X,Y),…
1
vote
1 answer

Clingo interpretation

I am trying to interpret a clingo code for a sudoku and the last two lines confuse a lot. Is there anyone experienced with that, who can explain to me what I see? %same_line(X1,X2) :- value(X1), value(X2), (X1-1)/3 == (X2-1)/3. %:- sudoku(X1,Y1,N),…
Myrto.S
  • 11
  • 1
1
vote
1 answer

How can I define a married couple in Clingo?

I'm trying to create 5 marriages, given 5 women and 5 man and their preferences to each other. homem(miguel). homem(joao). homem(pedro). homem(marco). homem(carlos). mulher(maria). mulher(paula). mulher(carla). mulher(cristina). mulher(ana). all…
1
vote
0 answers

Generate a randomized hitori board that can be solved with python

I have successfully created a clingo asp to solve hitori and it works well for examples of hitori boards found online but on trying to generate a hitori puzzle with random values for my clingo solver, it returns unsatisfiable, below is the code I am…
Oadeniran
  • 11
  • 1
1
vote
1 answer

Optimizing difficulty with a level generator using Clingo

I’m making a puzzle level generator (sokoban) using Clingo and got stuck trying to create levels with a specific move limit. The idea is to use the move limit to control difficulty of a level. This is how I’ve created the generator: Specify rules…
jokke
  • 65
  • 6
1
vote
1 answer

append an atom with exisiting variables and create new set in clingo

I am totally new in asp, I am learning clingo and I have a problem with variables. I am working on graphs and paths in the graphs so I used a tuple such as g((1,2,3)). what I want is to add new node to the path in which the tuple sequence holds. for…
Ali Ghazi
  • 45
  • 7
1
vote
1 answer

Practical Advantages and Disadvantages of Answer Set Programming/Logic Programming

I've recently taken an interest in Logic Programming, and more specifically Answer-Set Programming with CLINGO, and was wondering what the general consensus on this paradigm is in practical terms. For example, most declarative programs, including…
1
vote
1 answer

How to parse program parts in Clingo Python?

I'm trying to run the following Blockworld Planning Program in python: #include . #program base. % Define location(table). location(X) :- block(X). holds(F,0) :- init(F). #program step(t). % Generate { move(X,Y,t) : block(X), location(Y),…
thesofakillers
  • 290
  • 3
  • 13
1
vote
1 answer

How to create an optimal serializable plan in clingo?

I have the following blocks world program and I want to create a serializable plan for the following scenario: Initially: loc(m)=table, loc(l)=m, loc(a)=l, loc(b)=a, loc(c)=b, loc(o)=table, loc(n)=o, loc(d)=n, loc(e)=d, loc(j)=e, loc(k)=j,…
user11665646
1
vote
1 answer

ASP Core-2: Infinite Loop in Hamiltonian Path Solver

I am totally new in answer set proramming (ASP Core-2 with Clingo) and am struggling with a problem I have not been able to solve. The goal is to solve the 'Hamiltonian Path' problem, which is described as follows: In a directed graph we're looking…
BenjyTec
  • 1,719
  • 2
  • 12
  • 22
1
vote
1 answer

Answer Set Programming - filtering from a large number of models

instance.lp node(1). node(2). node(3). node(4). node(5). node(6). edge(1,2). edge(2,1). edge(4,1). edge(2,3). edge(2,6). edge(3,4). edge(3,5). edge(5,6). edge(6,3). begin(4). I have this problem instance, directed graph with a beginning node…
cheshire
  • 1,109
  • 3
  • 15
  • 37
1
vote
1 answer

Newbie question about the difference between integrity constraints and choice rules in ASP/Clingo?

#const w = 2. #const h = 1. % Create a grid wxh row(1..h). col(1..w). % Generate % {} below indicates all rooms need not exist in the solution. % There can be 1x1 rooms, that can be placed anywhere on the grid. {room11(X, Y) : col(X), row(Y) }. %…
Sid Datta
  • 1,110
  • 2
  • 13
  • 29
1
vote
1 answer

Why the disjunctive ASP program cannot return both disjunct predicates instance in an answer?

I am a newbie to ASP (Answer Set Programming). I tried the following program in clingo online version (reasoning mode = enumerate all) % instance member(dave). % encoding edu(X);rich(X) :- member(X). It returns: Answer: 1 member(dave)…
chansey
  • 1,266
  • 9
  • 20
1 2
3
10 11