Portability issues
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
@@ -204,15 +204,14 @@
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
:-module(flags, [
|
||||
problog_define_flag/4,
|
||||
problog_define_flag/5,
|
||||
problog_define_flag/6,
|
||||
problog_defined_flag/5,
|
||||
problog_defined_flag_group/1,
|
||||
set_problog_flag/2,
|
||||
reset_problog_flags/0,
|
||||
problog_flag/2]).
|
||||
:-module(flags, [problog_define_flag/4,
|
||||
problog_define_flag/5,
|
||||
problog_define_flag/6,
|
||||
problog_defined_flag/5,
|
||||
problog_defined_flag_group/1,
|
||||
set_problog_flag/2,
|
||||
reset_problog_flags/0,
|
||||
problog_flag/2]).
|
||||
|
||||
|
||||
:- use_module(gflags).
|
||||
@@ -344,8 +343,17 @@ learning_init_handler(validating, (_,_,_,_,_)).
|
||||
learning_init_handler(validated, _Value).
|
||||
learning_init_handler(stored, _Value).
|
||||
|
||||
learning_prob_init_handler(message, '(Q,P,Query)').
|
||||
learning_prob_init_handler(validating, (_,_,_)).
|
||||
learning_prob_init_handler(message, '(0,1] or uniform(l,h) ').
|
||||
learning_prob_init_handler(validating, uniform(Low,High)) :-
|
||||
number(Low),
|
||||
number(High),
|
||||
Low<High,
|
||||
Low>0,
|
||||
High =< 1.
|
||||
learning_prob_init_handler(validating, N) :-
|
||||
number(N),
|
||||
N>0,
|
||||
N =< 1.
|
||||
%learning_prob_init_handler(validate, V_).
|
||||
learning_prob_init_handler(validated, _Value).
|
||||
learning_prob_init_handler(stored, _Value).
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
@@ -515,16 +515,15 @@ logger_write_header :-
|
||||
bb_get(logger_filename,FName),
|
||||
bb_get(logger_variables,Variables),
|
||||
open(FName,'append',Handle),
|
||||
write(Handle,'# '),
|
||||
logger_write_header_intern(Variables,Handle),
|
||||
write(Handle,'\n'),
|
||||
format(Handle,'#####################################################################~n',[]),
|
||||
format(Handle,'# ~w~6+~w~7+~w~n',['Pos','Type','Name']),
|
||||
format(Handle,'#####################################################################~n',[]),
|
||||
logger_write_header_intern(Variables,1,Handle),
|
||||
format(Handle,'#####################################################################~n',[]),
|
||||
close(Handle).
|
||||
|
||||
logger_write_header_intern([],_).
|
||||
logger_write_header_intern([(Name,_Type)],Handle) :-
|
||||
write(Handle,Name).
|
||||
logger_write_header_intern([(Name,_Type),Next|T],Handle) :-
|
||||
bb_get(logger_delimiter,D),
|
||||
write(Handle,Name),
|
||||
write(Handle,D),
|
||||
logger_write_header_intern([Next|T],Handle).
|
||||
logger_write_header_intern([],_,_).
|
||||
logger_write_header_intern([(Name,Type)|T],Position,Handle) :-
|
||||
format(Handle,'# ~q~6+~q~7+~q~n',[Position,Type,Name]),
|
||||
Position2 is Position+1,
|
||||
logger_write_header_intern(T,Position2,Handle).
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-09-24 15:54:45 +0200 (Fri, 24 Sep 2010) $
|
||||
% $Revision: 4822 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-09-23 11:13:10 +0200 (Thu, 23 Sep 2010) $
|
||||
% $Revision: 4804 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-09-07 23:20:03 +0200 (Tue, 07 Sep 2010) $
|
||||
% $Revision: 4765 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
@@ -246,7 +246,7 @@
|
||||
|
||||
% load library modules
|
||||
:- use_module(library(tries)).
|
||||
:- use_module(library(lists), [append/3, member/2, memberchk/2]).
|
||||
:- use_module(library(lists), [append/3, member/2, memberchk/2, delete/3]).
|
||||
:- use_module(library(system), [delete_file/1, shell/1]).
|
||||
:- use_module(library(ordsets), [ord_intersection/3, ord_union/3]).
|
||||
|
||||
@@ -260,10 +260,10 @@
|
||||
|
||||
% this is a test to determine whether YAP provides the needed trie library
|
||||
:- initialization(
|
||||
( predicate_property(trie_disable_hash, imported_from(tries)) ->
|
||||
trie_disable_hash
|
||||
; print_message(warning,'The predicate tries:trie_disable_hash/0 does not exist. Please update trie library.')
|
||||
)
|
||||
( predicate_property(trie_disable_hash, imported_from(tries)) ->
|
||||
trie_disable_hash
|
||||
; print_message(warning,'The predicate tries:trie_disable_hash/0 does not exist. Please update trie library.')
|
||||
)
|
||||
).
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-09-24 15:54:45 +0200 (Fri, 24 Sep 2010) $
|
||||
% $Revision: 4822 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
@@ -204,17 +204,11 @@
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%%%%%%%%
|
||||
% Collected OS depended instructions
|
||||
%%%%%%%%
|
||||
:- module(utils_learning, [empty_bdd_directory/1,
|
||||
empty_output_directory/1,
|
||||
delete_file_silent/1
|
||||
]).
|
||||
:- module(utils_learning, [empty_bdd_directory/0,
|
||||
empty_output_directory/0,
|
||||
delete_file_silent/1,
|
||||
slice_n/4]).
|
||||
|
||||
% switch on all tests to reduce bug searching time
|
||||
:- style_check(all).
|
||||
:- yap_flag(unknown,error).
|
||||
|
||||
% load library modules
|
||||
:- use_module(library(lists), [append/3, member/2]).
|
||||
@@ -222,28 +216,33 @@
|
||||
|
||||
% load our own modules
|
||||
:- use_module(os).
|
||||
:- use_module(flags).
|
||||
|
||||
%========================================================================
|
||||
%=
|
||||
%=
|
||||
%========================================================================
|
||||
|
||||
empty_bdd_directory(Path) :-
|
||||
ground(Path),
|
||||
empty_bdd_directory :-
|
||||
problog_flag(bdd_directory,Path),
|
||||
!,
|
||||
|
||||
atom_codes('query_', PF1), % 'query_*'
|
||||
|
||||
directory_files(Path,List),
|
||||
delete_files_with_matching_prefix(List,Path,[PF1]).
|
||||
empty_bdd_directory :-
|
||||
throw(error(problog_flag_does_not_exist(bdd_directory))).
|
||||
|
||||
%========================================================================
|
||||
%=
|
||||
%=
|
||||
%========================================================================
|
||||
|
||||
empty_output_directory(Path) :-
|
||||
ground(Path),
|
||||
|
||||
empty_output_directory :-
|
||||
problog_flag(output_directory,Path),
|
||||
!,
|
||||
|
||||
concat_path_with_filename(Path,'log.dat',F1),
|
||||
concat_path_with_filename(Path,'out.dat',F2),
|
||||
|
||||
@@ -270,6 +269,9 @@ empty_output_directory(Path) :-
|
||||
directory_files(Path,List),
|
||||
delete_files_with_matching_prefix(List,Path,[PF1,PF2,PF3,PF4,PF5,PF6]).
|
||||
|
||||
empty_output_directory :-
|
||||
throw(error(problog_flag_does_not_exist(output_directory))).
|
||||
|
||||
%========================================================================
|
||||
%=
|
||||
%=
|
||||
@@ -300,3 +302,18 @@ delete_files_with_matching_prefix([Name|T],Path,Prefixes) :-
|
||||
),
|
||||
|
||||
delete_files_with_matching_prefix(T,Path,Prefixes).
|
||||
|
||||
%========================================================================
|
||||
%= Split a list into the first n elements and the tail
|
||||
%= +List +Integer -Prefix -Residuum
|
||||
%========================================================================
|
||||
|
||||
|
||||
slice_n([],_,[],[]) :-
|
||||
!.
|
||||
slice_n([H|T],N,[H|T2],T3) :-
|
||||
N>0,
|
||||
!,
|
||||
N2 is N-1,
|
||||
slice_n(T,N2,T2,T3).
|
||||
slice_n(L,_,[],L).
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
@@ -204,12 +204,7 @@
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
:- module(variable_elimination, [
|
||||
trie_check_for_and_cluster/1,
|
||||
trie_replace_and_cluster/2,
|
||||
clean_up/0,
|
||||
variable_elimination_stats/3
|
||||
]).
|
||||
:- module(variable_elimination, [trie_check_for_and_cluster/1, trie_replace_and_cluster/2, clean_up/0, variable_elimination_stats/3]).
|
||||
|
||||
:- use_module(library(lists), [append/3, delete/3, memberchk/2, reverse/2]).
|
||||
:- use_module(library(tries)).
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-08-24 15:23:06 +0200 (Tue, 24 Aug 2010) $
|
||||
% $Revision: 4672 $
|
||||
% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $
|
||||
% $Revision: 4838 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
|
||||
Reference in New Issue
Block a user