I'm working on some experiments for comparing different labeling heuristics in Sicstus Prolog.
But I keep getting into 'Resource error: insufficient memory'.
I'm pretty sure I'm doing something wrong in my testcode.
The following code will replicate my problem:
:- use_module(library(clpfd)).
:- use_module(library(lists)).
atest( R, C ):-
X is R * C,
length( M, X),
domain( M, 0, X),
all_distinct( M ),
statistics(walltime, [_,_SinceLast]),
labeling( [],M ),
statistics(walltime, [_,SinceLast]),
write('Labeling time: '), write(SinceLast),write('ms'),nl.
% Testcode for looping through alot of variations and run one test for each variant
t1:-
Cm = 1000,
Cr = 1000,
(
for(C,0, Cm),
param([Cm,Cr])
do
(
for(R, 0, Cr ),
param([C])
do
atest( C, R )
)
).
A short time after I call the t1 predicate, I get a 'Resource error: insufficient memory' exception.
I guess I should do something after I call atest to release resources?
Also: Is this the correct way to measure labeling-time? Any better way to do this?