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.
80
questions
1
vote
1
answer
29
views
prolog max_min_eval/2 solution issue
I want to create a predicate max_min_eval/2 or max_min_eval(List,Result) which read a list like this [1,min,2,max,4,max,3] -> (((1 min 2) max 4) max 3) in eclipse prolog and put the Result into a ...
1
vote
2
answers
93
views
How to read large Prolog files in ECLiPSe?
I generated a large file of paths via eclipse. Each line contains a clause for a list of 27 points.
$ wc -l snake_points.pl
240917 snake_points.pl
$ ls -lh snake_points.pl
-rw-rw-r-- 1 carl carl 72M ...
0
votes
2
answers
83
views
How to use Prolog's foreach/2 loop
I am trying to get the foreach/2 loop to work in Prolog (using tkeclipse). I understand it needs an element in the first argument and a list to search for that element within as a second argument.
My ...
1
vote
1
answer
78
views
ECLiPSe CLP - TSP with Time WIndow. How do i calculate the cost?
I'm working on a variant of a TSP, where each node has a Time Window, but i've some problems calculating the cost function.
I'm using a succesors model, so i have a list where each variable rapresents ...
1
vote
1
answer
106
views
Age comparsion for Zebra Riddle
I'm trying to solve a logic riddle similar to the Einstein riddle with ECLiPSe Prolog via CLP:
A band has 6 jazz-musicians, no one is younger than 70 years old. Every artist has written a different ...
1
vote
1
answer
58
views
Is there a good source for finding common problems with ECLiPSe?
As a new ECLiPSe user I am running into problems.
I was able to consult a .pl file, but when I changed the extension to .ecl I got a file-does-not-exist message.
I was even able to run the .pl file,...
1
vote
0
answers
73
views
Pruning symmetrical solutions in ECLiPSe Prolog with the use of constraints
This is a subproblem of a constraint satisfaction problem I'm currently working on and thus, I've omitted extra constraints that I apply to my variables.
Suppose we have a list of 5 variables and ...
2
votes
1
answer
55
views
Is there any explicit support for modulo operation in eplex library
I am using eplex and ic library and trying to solve a problem. I see that the eplex and ic provide explicit support for addition,multiplication and subtraction but there is no support for modulo or ...
0
votes
1
answer
101
views
Is it possible to delay an assignment operation
I have a small script/code and i want to impose some active constraints. In the code shown below, i have P[I,J] #= E and in the next line Result[I,E] #= J but this is throwing an instantiation error ...
1
vote
1
answer
88
views
Two objective functions
If we have two objective functions in Eclipse CLP that Cost1 is more important than Cost2, is the following true?
minimize(minimize(labeling(Vars), Cost1), Costs2).
1
vote
2
answers
90
views
How integer suspension will be handled when it is used in head of a condition
I have the following conditions over two variable A and B:
[A,B] #:: 1..10,
(A #= 3) or (B #= 3),
((A #> 3 or B #>3) ->
% expression 1
;
% expression 2
)
%cntd
The problem is in ...
1
vote
1
answer
91
views
Eclipse CLP: maximum number of constraints/variables
In the Eclipse CLP, how many constraints or variables can I define?
I am currently remodeling my scheduling problem - I need to replace a single alldifferent constraint with many atmost constraints. ...
2
votes
1
answer
72
views
Internal workings of ic_global/occurrences/3
For the QuasiGroup completion problem I implemented two models. One of them is a model based on nothing but channeling constraints (based on a study by Dotu). The other one is a model based on the ...
1
vote
0
answers
45
views
A General Method To Transpile A Code in Eclipse CLP to CHR
My question is a little general but the answer to my specific question could be very helpful. The general question is "Is there any general method to transfer code in Eclipse CLP prolog to a ...
1
vote
1
answer
37
views
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 ...
1
vote
1
answer
97
views
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) :-...
1
vote
1
answer
169
views
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 ...
2
votes
1
answer
55
views
CLP: Efficient model of 'not three same values'
I need to model this (simple) constraint in Eclipse CLP:
Given three domain variables, lets say D1, D2, and D3 and I want to ensure that these three variables will not end up with the same value. Two ...
0
votes
1
answer
210
views
Apply OR constraint over the variables in a list
Suppose we have a list of variables. We want to apply a constraint over the variables, but the relation of these constraints are or. How we can do this in Eclipse CLP (prolog)?
We should notice that ...
0
votes
2
answers
85
views
How can use data file with Eclipse-clp program
How can use data file with Eclipse-clp or Prolog program. for Variables and Array values. for example if you want to give data to program as an big Array.How can read this data from a data files?
0
votes
0
answers
57
views
How to implement these Sigma notations in ECLIPSE-CLP or Prolog
Is it possible for someone to tell me how to implement these sigmas in ECLiPSe-CLP or Prolog or at least give me guidance on how to implement and solve them.
0
votes
1
answer
435
views
why this code cannot be run?what is "syntax error: postfix/infix operator expected" error in ECLiPSe-clp
When I want to run this code in ECLiPSe-CLP I get the following Error
Error:
string stream 27: syntax error: postfix/infix operator expected
| 4 $= X^2 + Y^2, (Error Mark is under '=')
| ...
1
vote
1
answer
60
views
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,_, _,_,_, ...
1
vote
1
answer
46
views
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),
...
0
votes
1
answer
91
views
How to implement This MP problem in ECLIPSE CLP or Prolog?
I want to implement this Summations as Objective and Constraints(1-6)
Could anyone help me that how I can Implement them?
OBJ: Min ∑(i=1..N)∑(j=1..N) Cij * ∑(k=1..K)Xijk
constraint :
∑(...
0
votes
1
answer
111
views
instantiation fault in indomain
I have a board solver which its general form of the solver likes the below:
solver(Board):-
constraints(Board),
search(Board).
It passes the constraint predicate, but there is an error in ...
1
vote
1
answer
72
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.....
1
vote
1
answer
93
views
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 ...
0
votes
1
answer
25
views
How To write a query for testing the following code that written with eplex Lib in ECLiPSe-CLP
I am new in ECLiPSe and have a follwing problem.
when I write and compile this simple program:
---------------------------------
:- lib(eplex).
main1(Cost, Vars) :-
Vars = [A1, A2, A3, B1, B2, B3, ...
3
votes
1
answer
375
views
The difference between dollar sign ($) and number (or hash) sign (#) in Prolog
As I found I can use from $ and # in the shortened version of the suspend in Prolog. Hence, I can write the following query:
?- X $> 2, X = 2.5.
And the result is:
X = 2.5
Yes (0.11s cpu)
So ...
1
vote
3
answers
134
views
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 ...
0
votes
1
answer
138
views
How to suspend in ECLiPSe CLP until full list is instantiated?
ECLiPSe CLP has a built-in predicate suspend(+Goal, +Prio, +CondList) whereby CondList often is of the form X -> inst. But how can you suspend until a whole list is instantiated? If you do List -> ...
0
votes
0
answers
70
views
make display matrix prolog tkeclipse
I am new to prolog and want to generate a display matrix from the below prolog code as given in the image The image below is generated from the given prolog code using tkEclipse (Eclipse for prolog)
...
0
votes
1
answer
73
views
Constructing an array of ground data from list of integers in ECLiPSe
I'm trying to use the make_graph_symbolic/3 from the graph_algorithms library, which requires for the Nodes to be an array of ground data.
As I'm constructing this graph from a matrix, the nodenames ...
0
votes
2
answers
93
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, ...
1
vote
1
answer
133
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 ...
1
vote
1
answer
289
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 ...
3
votes
3
answers
164
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,...
1
vote
1
answer
75
views
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],
...
1
vote
1
answer
126
views
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{...
8
votes
3
answers
1k
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 ...
1
vote
0
answers
123
views
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 ...
1
vote
1
answer
795
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?
0
votes
1
answer
203
views
Custom heuristic in ECLiPSe CLP
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)...
1
vote
0
answers
104
views
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)...
3
votes
1
answer
391
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,...
2
votes
1
answer
255
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 ...
0
votes
1
answer
137
views
How does subscript work?
In this first picture I get the first element of the array by using:
subscript(array,[1],First)
In this second picture I try the same but then for the second element but it gets everything from the ...
3
votes
1
answer
262
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)...
1
vote
1
answer
172
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 ...