Questions tagged [eclipse-clp]

0

votes
0

answer
7

Views

Message “calling an undefined procedure lists : ” in running NQueens

when I want to run queens(8) ,Gives this Error calling an undefined procedure lists : middle_out([_281, _299, _317, _335, _353, _371, _389, _407], _7656) in module eclipse :- lib(ic). queens(N, Qs) :- % The model: Qs is a list of column numbers length(Qs, N), Qs :: 1..N, ( fromto(Qs,[Q1|Q2s],Q2s,[])...
ARZ
1

votes
0

answer
6

Views

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 at the end. However, I get the following error: instan...
OmG
1

votes
1

answer
288

Views

How can I speed up this program? It is a coin holder calculation

So this is a program where it calculates the fewest number of coins to carry with certain values on these coins. The program works, but it's way too slow... When you replace the length of the values 7 or less, it works... But 8 or above, it's really, really slow. Is there any way to speed up this pr...
user3390252
1

votes
2

answer
112

Views

Connecting java with constraint logic programming

i'm trying to connect java with constraint logic, i'm using netbeans for java and eclipse 6.1 for constraint logic, but when i'm trying to run the code there is an exception appears java.lang.IllegalArgumentException: Missing eclipse.directory property i've used a tutorial that explain how to connec...
Rana Mohamed
1

votes
1

answer
502

Views

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
1

votes
1

answer
101

Views

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 phase? The output prints only (for instance) Found a...
damianodamiano
1

votes
2

answer
197

Views

How to read a stream in Eclipse CLP?

I am new to Eclipse, and I have been trying to read a file stream without success. The code that I normally use for this in SWI-Prolog is this: read_until_stop(File, [L|Lines]) :- read_line_to_codes(File, Codes), Codes \= end_of_file, atom_codes(L, Codes), L \= stop, !, read_until_stop(File, Lines)....
picardo
1

votes
1

answer
73

Views

ECLiPSe CLP : Pause between subresults found by search/6 in ic library

(This question regards search/6.) I was wondering if there is a way -rather than manual tracing- to pause the execution of search/6 every time a new solution for a single variable was found? I would like to accomplish this to further investigate what is happening during search in constrained models....
SND
1

votes
1

answer
115

Views

How to use clpfd in eclipseCLP prolog (no eclipse java IDE)

I'm trying to make a simple route plan with CLP in prolog using eclipseclp and I want to use the clpfd prolog library, but the compiler doesn't recognize them. I obtain this error: library not found in use_module(library(clpfd)) I have installed all the third party libraries of eclipseCLP but I can'...
rafaelleru
1

votes
1

answer
84

Views

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 variables which do not already have finite bounds will...
damianodamiano
1

votes
2

answer
67

Views

Why a bignumber is shown incomplete in ECLiPSe Prolog?

I use the latest version of ECLiPSe Prolog 64-bit for Windows, then I compile the code: :- op(200, yf, !). !(N, F) :- fac(N, 1, F). fac(0, F0, F) :- !, F=F0. fac(N, F0, F) :- N1 is N-1, F1 is F0*N, fac(N1, F1, F). Query entered: ?- X is 100000 !. X = 28242294079603478742934215200555696886678... Yes...
T. S. Larsen
1

votes
4

answer
223

Views

Is there a way to use module/2 in ECLiPSe Prolog?

In SWI-Prolog, I am using code such as at the beginning of a module text file: :- module(foo, [bar/2]). :- use_module(library(jack)). I don't want to change my code. How can I neverthelss use ECLiPSe Prolog (*). Is there some library that defines a module/2 directive in ECLiPSe Prolog? Best Regards...
j4n bur53
3

votes
1

answer
170

Views

Exact solutions for lib(ic)

Using ECLiPSe Prolog's lib(ic) I stumbled upon the following problem from David H. Bailey, 'Resolving numerical anomalies in scientific computation.' which I was referred to by the Unum book. Actually, it is only part of it. First, let me formulate the equation in terms of (is)/2. Also, please note...
false
1

votes
1

answer
288

Views

What is the meaning of the double plus (++) instantiation mode in ECLiPSe Prolog?

A comprehensive list of Prolog instantiation modes is given in a previous question: Meaning of instantiation mode indicators in arguments of Prolog predicates. However, I have not been able to find any reference to or explanation about the double plus (++) instantiation mode in ECLiPSe Prolog. An ex...
Simon Slangen
3

votes
1

answer
335

Views

ECLiPSe CLP puzzle: perfect rectangle fitting

I'm working on a puzzle known as 'divide-by-box'. In essence, it's a form of perfect rectangle fitting, based on given clues. The rules are: Some grid cells contain numbers (this is known input data) The task is to partition the grid area into rectangular rooms satisfying following constraints: each...
SND
3

votes
1

answer
575

Views

Measuring execution time ECLiPSe CLP (or Prolog)

How do I measure the execution time of a method in ECLiPSe CLP? Currently, I have this: measure_traditional(Difficulty,Selection,Choice):- statistics(runtime, _), time(solve_traditional(Difficulty,Selection,Choice,_)), time(solve_traditional(Difficulty,Selection,Choice,_)), time(solve_traditional(D...
Babyburger
5

votes
1

answer
324

Views

How to convert vectors to arrays in ECLiPSe (CLP)? (or Prolog)

I have to solve Sudoku puzzles in the format of a vector containing 9 vectors (of length 9 each). Seeing as vectors are linked lists in Prolog, I figured the search would go faster if I transformed the puzzles in a 2D array format first. Example puzzle: puzzle(P) :- P = [[_,_,8,7,_,_,_,_,6], [4,_,...
Babyburger
2

votes
1

answer
222

Views

How do you check the elements of a submatrix in Prolog

I am trying to write a Shikaku solver in EclipsE Prolog. My contraints are defined as follow: solve(Problemname):- writeln('Start shikaku.'), problem(Problemname, Width, Height, Hints), shikaku(Width, Height, Hints). shikaku(Width, Height, Hints):- length(Hints, HintCount), array_list(HintsArray, H...
JorenV
1

votes
1

answer
127

Views

ECLiPSe clp : getting all adjacent cells on grid

So my problem is the following: I want, given some point with X,Y-coordinates in a grid, to return all of its adjacent cells. ( Note: in the following examples, I'm using the notation UL = upper-left, UM = upper-middle, UR = upper-right, L = left, R = right, BL = bottom-left, BM = bottom-middle and...
SND
4

votes
1

answer
225

Views

3-in-a-row logic puzzle: optimisation for sequence constraints in lists/arrays

In the following puzzle we try and fill the grid with blue and white squares in such a way that: A 3-in-a-row (or column) of the same colour is not allowed. Each row and column has an equal number of blue and white squares. If we now represent white with a 0 and blue with a 1, we get: 0 _ _ _ 1 _ _...
SND
2

votes
3

answer
288

Views

Constraint Programming toolset with most active community & resources

I'm new to CP. So far I've played with MiniZinc and I'm finding this a lot of fun. Before I commit too much, I want to figure out what CP language & solver is best to start with in terms of most active community, actively being developed and used in research, and best learning resources (examples &...
Mike
2

votes
1

answer
130

Views

Profiling ECLiPSe CLP?

I made two implementations to solve Shikaku puzzles. One uses Top,Left,Width and Height (TLWH) as parameters for each rectangle, the other Top,Left,Bottom,Right (TLBR). For some reason the one using TLBR is much faster, but I'm not really sure why. So I was wondering if there is a way to see what co...
The Oddler
2

votes
1

answer
210

Views

How can I freely assert/retract facts with modules in ECLiPSe Prolog?

I am trying to run the following test case: test :- assertz(abc : uvw(1)). The above works in SWI-Prolog. But I am having problems in making it work in ECLiPSe Prolog. I am getting the following error: trying to redefine an existing imported procedure in assertz(abc : uvw(1)) I didn't import abc:uvw...
j4n bur53
2

votes
1

answer
138

Views

Simple Arithmetic Constraint on List ECLiPSe clp

I want to do a simple constraint over all values of a list, I want each index of each row of an array to have the following (ic) constraint: 500 #= 2^X1 + 2^X2 + 2^X3 + ... + 2^X9 I try to do the code below. Array is a 9x9 matrix and for every row I want the above constraint to be satisfied. However...
revolution64
8

votes
3

answer
709

Views

Example channelling constraints ECLiPSe

Can someone provide a simple example of channelling constraints? Channelling constraints are used to combine viewpoints of a constraint problem. Handbook of Constraint Programming gives a good explanation of how it works and why it can be useful: The search variables can be the variables of one of t...
Stanko
1

votes
1

answer
310

Views

Instantiation fault ECLiPSe CSP

I have problems with my CSP under ECLiPSe. I wish to add a constraint to my cryptogram which requires that the number represented by TWO is divisible by 2. [eclipse 11]: test(Xs). instantiation fault in (_268{[1..4]}*100 + _200{[0..9]}*10 + _302{[0..9]}*1) mod 2#=0 Abort Thanks for your help. My cod...
superyo40
3

votes
1

answer
147

Views

An alldifferent for tuples

I'm trying to solve a sudoku with the viewpoint that every number has 9 positions. This is the representation for my sudoku: From the table you can read that number 5 has following positions (Row,Col) in the sudoku: (2,8),(4,2),(6,5). When I mention a row in my explanation, I mean a row like this: F...
Stanko
3

votes
2

answer
107

Views

Whats wrong with this prolog optimization solution?

solve(Amounts) :- Total = 1505, Prices = [215, 275, 335, 355, 420, 580], length(Prices, N), length(Amounts, N), Amounts :: 0..Total//min(Prices), Amounts * Prices #= Total, labeling(Amounts).
AAAA
3

votes
3

answer
98

Views

How do I specify to Prolog that all the elements of a list have to be 1 or 0?

How do I make sure that all the elements of a prolog list are either 0 or 1? I need to generate a list of given length and make sure it has only these 2 numbers in it: E.g. [0,0,0,0,0,0], [1,0,0,1,0,1,1] etc I suppose the use of libraries like IC or FD is needed but I can't quite figure out h...
Zap