Questions tagged [sicstus-prolog]

SICStus Prolog is an ISO-standard compliant Prolog dialect developed at the Swedish Institute of Computer Science (SICS). Current version: 4.3.5 - as of 2016-12-08

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.

125 questions
37
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,143
  • 1
  • 11
  • 19
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
  • 19,449
  • 4
  • 51
  • 152
12
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.
  • 4,708
  • 8
  • 49
  • 78
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
  • 19,449
  • 4
  • 51
  • 152
11
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
  • 19,449
  • 4
  • 51
  • 152
9
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,409
  • 16
  • 37
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),…
7
votes
3 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 problem,…
Educorreia
  • 146
  • 3
  • 15
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
  • 2,897
  • 4
  • 19
  • 17
6
votes
1 answer

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
  • 19,449
  • 4
  • 51
  • 152
6
votes
3 answers

Memory leak Sicstus Prolog

This question is a followup from this question. I'm running a large number of tests in Sicstus prolog: runtest:- t1, t2, t3, . . t100. Each test is standalone and will print its result to the screen. There is no releation between the tests,…
MortenM
  • 562
  • 2
  • 12
5
votes
1 answer

Verify_attributes in SICStus Prolog

Attribute variables permit to extend unification. The following is about arcane details of the interface. Let's cut right to the chase! In sicstus-prolog library(atts) provides predicates for using attributed variables. I think I get what the…
repeat
  • 19,449
  • 4
  • 51
  • 152
5
votes
1 answer

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
  • 173
  • 1
  • 10
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
  • 19,449
  • 4
  • 51
  • 152
1
2 3
8 9