Questions tagged [eclipse-clp]

ECLiPSe is a constraint logic programming system that works with Prolog as a basic engine. It includes modules for integer constraint logic programming as well as floating points. It also supports a large number of global constraints.

Books

A free downloadable pdf

A Gentle Guide to Constraint Logic Programming via ECLiPSe

83 questions
1
vote
1 answer

Enforcing inequality of lists?

For a given CSP I used a variety of viewpoints, one of which is a somewhat more exotic boolean model which uses a variable array of size NxNxN. Then I enforce unequality of various subarrays with this snippet : (foreach(X, List1), foreach(Y,…
1
vote
1 answer

Looping through a list which is a subarray

I'm using ECLiPSe 6.1. I have an array of variables of dimension N x N, let's call it Vars. Now I call a procedure with, say, my_procedure(Vars[1..N,1..2]). Inside the procedure (my_procedure(List) :- ...), something like (foreach(X, List) do ...)…
1
vote
1 answer

Eclipse CLP labeling: exclude permutations

I am solving a scheduling problem (briefly described here: SWI Prolog CLP(FD) scheduling switched to ECLP). I am able to get some solution quickly, but now I want to incorporate some optimization task. A part of the problem/schedule row looks like…
Jan Drozen
  • 894
  • 2
  • 12
  • 28
1
vote
1 answer

Possible bug with nth1 predicate in Eclipse-clp?

I'm writing a sudoku solver in Prolog. The sudoku itself is given as a vector of vectors: P = [[1,_,_, _,_,_, _,_,_], [_,_,2, 7,4,_, _,_,_], [_,_,_, 5,_,_, _,_,4], [_,3,_, _,_,_, _,_,_], [7,5,_, _,_,_, _,_,_], [_,_,_,…
SJoos
  • 91
  • 8
1
vote
1 answer

What value should be written to run the code correctly?

What value should be written to run the code correctly. I give any amount I do not see any output. f(T, Y) :-Y is sqrt(abs(T)) + 5*T^3. main :- read(As), length(As, N), reverse(As , Rs), ( foreach(Ai , Rs), for(I, N - 1, 0, -1) do …
ARZ
  • 43
  • 7
1
vote
1 answer

Integer range suspension in prolog

I have the following query: ?- Remainder :: 0..8, Qoutient #:: 0..Dividened, Dividened #= Qoutient * 9 + Remainder, Dividened = 12. As you can see I have an integer suspension Qoutient #:: 0..Dividened, and try to clear the value of the Dividend…
OmG
  • 18,337
  • 10
  • 57
  • 90
1
vote
1 answer

Constraint over the integer division

I have the following statement in prolog (Eclipse CLP): ?-X::1..100, X/5 #= 2, X = 12. The result is No.. I want to check that the integer division of X over 5 is equal to 2 or not. If I write the following statement: ?-X::1..100, X//5 #= 2, X =…
OmG
  • 18,337
  • 10
  • 57
  • 90
1
vote
3 answers

Avoid findall overflow with n-fractions problem

I am trying to print all solutions of the n-fractions problem for n=4: :- lib(ic). fractions(Digits) :- Digits = [A,B,C,D,E,F,G,H,I,J,K,L], Digits #:: 1..9, ic:alldifferent(Digits), X #= 10*B+C, Y #= 10*E+F, Z #= 10*H+I, V…
Codefather
  • 27
  • 1
  • 9
1
vote
1 answer

Handle huge numeric values prolog

I'm working with prolog and i need to handle huge numerical values (i know, prolog is not originaly designed to handle numbers). I'm using ECLiPSe 6.1 and the documentation of some built in predicates as fd_global:ordered_sum\2 says: Any input…
damianodamiano
  • 2,528
  • 2
  • 13
  • 21
1
vote
1 answer

Print minimize steps prolog

I'm working on a prolog program (CLPFD) with ECLiPSe 6.1. The program has a lot of variables and i want to minimize a certain value but (obviously) the minimization steps takes a lot of time. How can i print each solution found during the minimize…
damianodamiano
  • 2,528
  • 2
  • 13
  • 21
1
vote
1 answer

ECLiPSe CLP produces variable with unexpected range

I have a question regarding the following code: :-lib(ic). buggy_pred(Result, In0, In1, In2, In3, In4, In5, In6, In7) :- Args = [In0, In1, In2, In3, In4, In5, In6, In7], Args :: [0..255], Result :: [0..18446744073709551615], %…
krzysiekb
  • 57
  • 1
  • 6
1
vote
1 answer

Listing all constraints in Eclipse CLP in a readable form

I have an ECLiPSe script whose goal is to encode my problem into a set of arithmetic constraints. In REPL, I eventually get a list of delayed goals which looks as follows: -(_2941{4 .. 7}) + _2900{1 .. 4} #=< 0 _2941{4 .. 7} - _2900{1 .. 4}…
Alek81
  • 23
  • 3
1
vote
0 answers

ECLiPSe CLP : slow combined occurrence/3 constraint behaviour

As a subset of a larger problem, I'm trying to write the 2 following constraints for an NxN board (containing N² cells): Each row/col contains exactly N occurrences of integer K given by pre-defined hints No 2x2 block (anywhere on the board)…
SND
  • 1,552
  • 2
  • 16
  • 29
1
vote
1 answer

Active vs Passive constraints in ECLiPSe CLP

What is the difference between active and passive constraints in the ECLiPSe CLP language? And how/when can I use one or the other?
The Oddler
  • 6,314
  • 7
  • 51
  • 94
1
vote
0 answers

Strange behaviour by heuristics when solving a CSP

Consider the following puzzle: A cell is either marked or unmarked. Numbers along the right and bottom side of the puzzle denote the total sum for a certain row or column. Cells contribute (if marked) to the sum in its row and column: a cell in…
svdc
  • 154
  • 2
  • 10