Questions tagged [sicstus-prolog]

SICStus Prolog is an ISO-standard compliant Prolog dialect developed at the Swedish Institute of Computer Science (SICS).

SICStus Prolog is an ISO-standard compliant Prolog dialect developed at the Swedish Institute of Computer Science (SICS). As of 2021-01-03, the current version is 4.6.0.

Home page.

135 questions
36
votes
5 answers

Prolog Constraint Processing : Packing Squares

I'm trying to solve a constraint processing problem in prolog. I need to pack 4 squares of 5x5,4x4,3x3 and 2x2 in a grid of 10x10. They may not overlap. My variables look like this: Name: SqX(i), i=1..10, domain: 1..10 Where X is either 5,4,3 or 2.…
Sven
  • 1,133
  • 1
  • 11
  • 22
25
votes
1 answer

Passing arbitrary-sized integers from Prolog to C

Right now, I'm learning how to interface SICStus Prolog with C code. I would like to have/use/see a C implementation of "Hamming weight" of arbitrary-sized integers in SICStus Prolog version 4. It seems to me that I need C functions for testing term…
repeat
  • 18,496
  • 4
  • 54
  • 166
11
votes
3 answers

Optimizing pathfinding in Constraint Logic Programming with Prolog

I am working on a small prolog application to solve the Skyscrapers and Fences puzzle. An unsolved puzzle: A solved puzzle: When I pass the program already solved puzzles it is quick, almost instantaneous, to validate it for me. When I pass the…
F. P.
  • 5,018
  • 10
  • 55
  • 80
11
votes
1 answer

Unexpected behavior of frozen/2

I was playing around with the prolog-coroutining predicates freeze/2 and frozen/2: ?- freeze(X,a=a), frozen(X,Goal). ?- freeze(X,a=a), freeze(Y,b=b), X=Y, frozen(X,Goal). sicstus-prolog (version 4.5.1 for x86_64) gave these answers: | ?-…
repeat
  • 18,496
  • 4
  • 54
  • 166
10
votes
1 answer

How can I inspect WAM code in SICStus Prolog

In the context of hacking clpz on sicstus-prolog I want to glimpse at the warren-abstract-machine code generated by SICStus Prolog. As an example, let's dissect the following predicate! is_list([]). is_list([_|Es]) :- is_list(Es). Here's what I'm…
repeat
  • 18,496
  • 4
  • 54
  • 166
8
votes
4 answers

Prolog: Random Labeling

I have a program written in Sicstus Prolog using constraints. My goal is to use labeling/2 and some other method to obtain a random instantiation of my variables. Example: X #> 2, Y #= 2*X, Z #<10 If I use List = [X,Y,Z], labeling([], List) The…
ecc
  • 1,490
  • 1
  • 17
  • 42
8
votes
1 answer

Prolog delayed evaluation: LIFO or FIFO wake-up?

Many Prolog systems have a freeze/2 predicate, a predicate that should possibly have the name geler/2 since it was even invented before Prolog-II. Assume I have a condition on the same variable, but two different goals, i.e.: ?- freeze(X, G1),…
user502187
7
votes
2 answers

Square Puzzle Problem Solution with Constraint Programming

Question: Fill in the grid with squares (of any size) that do not touch or overlap, even at the corners. The numbers below and at the right indicate the number of grid squares that are filled in the corresponding column / row. To solve this…
Educorreia
  • 375
  • 5
  • 21
7
votes
1 answer

Expressing setup time with cumulatives

There are many families of scheduling problems. I'm looking into a problem where I have families of jobs/tasks where the transition from one family to another family require reconfiguring the machine (setup time). I'm using cumulatives[2/3] to solve…
6
votes
1 answer

Prolog- Loading A Library from a File

The Sicstus manual says to use this to load a library: use_module(library(Package)). This works in Prolog on the command line, but I can't find out how to load a library from a Prolog source file. When I include "use_module(library(Package))." in my…
Daniel Sopel
  • 3,535
  • 4
  • 24
  • 17
6
votes
2 answers

Extending unification, SICStus-style

I want to understand SICStus-style extensible unification. The User's Manual on library(atts) states that: Module:verify_attributes(-Var, +Value, -Goals) hook ... verify_attributes/3 may invoke arbitrary Prolog goals, but Var should not be bound…
repeat
  • 18,496
  • 4
  • 54
  • 166
6
votes
1 answer

SICStus Prolog JIT compiler

SICStus Prolog 4.3 added a JIT compiler for x86-64 processors. I have two questions regarding the JIT compiler. First, where can I find some documentation (papers, notes, or memos) on the capabilities (and limitations, design, and techniques) of the…
repeat
  • 18,496
  • 4
  • 54
  • 166
5
votes
2 answers

SICStus Prolog: Find all solutions

Is there a way one can show all solutions and/or find how many there are in SICSTus prolog? For instance, the code below maybe used to solve the map colouring problem. :- use_module(library(clpfd)). solve_AUSTRALIA(WA,NT,Q,SA,NSW,V):- …
Enigma
  • 305
  • 2
  • 11
5
votes
3 answers

Performance of the built-in Prolog predicate (is)/2

Update: 11.6.2016 The baffling performance discrepancy which I had observed with SICStus Prolog 4.3.2 has completely disappeared with the recently released SICStus Prolog 4.3.3. Kudos! I updated the "runtimes" table below to include SICStus Prolog…
repeat
  • 18,496
  • 4
  • 54
  • 166
5
votes
2 answers

Restricting goal_expansion/6 to compile time only

In SICStus Prolog, there is a hook for expanding a goal: goal_expansion/6 which is called both at compile time and at runtime during metacalling. These calls incur quite some runtime overhead which slows down metacalling. The purpose of my…
false
  • 10,264
  • 13
  • 101
  • 209
1
2 3
8 9