Fixing minor portability issues
This commit is contained in:
parent
d5879430da
commit
8cf9568c8b
|
@ -212,7 +212,8 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
:- module(extlists, [open_end_memberchk/2, open_end_add/3, open_end_add_unique/3, open_end_close_end/2]).
|
||||
:- use_module(library(lists)).
|
||||
|
||||
:- use_module(library(lists), [memberchk/2]).
|
||||
|
||||
open_end_memberchk(_A, []):-!, fail.
|
||||
open_end_memberchk(A, L-E):-
|
||||
|
|
|
@ -299,7 +299,7 @@ get_digits(Num, Digits, Acc):-
|
|||
%
|
||||
% Simple Counters
|
||||
%
|
||||
:- bb_put(array_count, 1).
|
||||
:- initialization(bb_put(array_count, 1)).
|
||||
|
||||
get_next_array(ID, Name):-
|
||||
bb_get(array_count, ID),
|
||||
|
|
|
@ -225,10 +225,11 @@
|
|||
:- yap_flag(unknown,error).
|
||||
:- style_check(single_var).
|
||||
|
||||
:- bb_put(logger_filename,'out.dat').
|
||||
:- bb_put(logger_delimiter,';').
|
||||
:- bb_put(logger_variables,[]).
|
||||
|
||||
:- initialization((
|
||||
bb_put(logger_filename,'out.dat'),
|
||||
bb_put(logger_delimiter,';'),
|
||||
bb_put(logger_variables,[])
|
||||
)).
|
||||
|
||||
%========================================================================
|
||||
%= Defines a new variable, possible types are: int, float and time
|
||||
|
|
|
@ -206,7 +206,7 @@
|
|||
|
||||
:- module(mc_DNF_sampling, [problog_dnf_sampling/3]).
|
||||
|
||||
:- use_module(library(lists)).
|
||||
:- use_module(library(lists), [memberchk/2]).
|
||||
|
||||
:- use_module(variables).
|
||||
:- use_module(sampling, _, [problog_random/1,
|
||||
|
@ -219,12 +219,14 @@
|
|||
|
||||
:- use_module(hash_table).
|
||||
|
||||
:- problog_define_flag(search_method, problog_flag_validate_in_list([linear, binary]), 'search method for picking proof', binary, monte_carlo_sampling_dnf).
|
||||
:- problog_define_flag(represent_world, problog_flag_validate_in_list([list, record, array, hash_table]), 'structure that represents sampled world', array, monte_carlo_sampling_dnf).
|
||||
:- initialization((
|
||||
problog_define_flag(search_method, problog_flag_validate_in_list([linear, binary]), 'search method for picking proof', binary, monte_carlo_sampling_dnf),
|
||||
problog_define_flag(represent_world, problog_flag_validate_in_list([list, record, array, hash_table]), 'structure that represents sampled world', array, monte_carlo_sampling_dnf),
|
||||
|
||||
:- problog_var_define(dnf_sampling_time, times, time, messages('DNF Sampling', ':', ' ms')).
|
||||
:- problog_var_define(probability_lower, result, untyped, messages('Lower probability bound', ' = ', '')).
|
||||
:- problog_var_define(probability_upper, result, untyped, messages('Upper probability bound', ' = ', '')).
|
||||
problog_var_define(dnf_sampling_time, times, time, messages('DNF Sampling', ':', ' ms')),
|
||||
problog_var_define(probability_lower, result, untyped, messages('Lower probability bound', ' = ', '')),
|
||||
problog_var_define(probability_upper, result, untyped, messages('Upper probability bound', ' = ', ''))
|
||||
)).
|
||||
|
||||
% problog_independed(T, P):-
|
||||
% tries:trie_traverse_first(T, FirstRef), !,
|
||||
|
|
|
@ -216,12 +216,13 @@
|
|||
|
||||
|
||||
% load library modules
|
||||
:- use_module(library(system)).
|
||||
:- use_module(library(system), [exec/3, file_exists/1]).
|
||||
|
||||
% load our own modules
|
||||
:- use_module(gflags, _, [flag_get/2]).
|
||||
|
||||
:- dynamic [problog_path/1, problog_working_path/1].
|
||||
:- dynamic(problog_path/1).
|
||||
:- dynamic(problog_working_path/1).
|
||||
|
||||
set_problog_path(Path):-
|
||||
retractall(problog_path(_)),
|
||||
|
|
|
@ -225,7 +225,7 @@
|
|||
problog_help/0]).
|
||||
|
||||
% load library modules
|
||||
:- use_module(library(lists)).
|
||||
:- use_module(library(lists), [member/2]).
|
||||
|
||||
% load our own modules
|
||||
:- use_module(flags).
|
||||
|
|
|
@ -210,9 +210,6 @@
|
|||
:- module(print_learning, [format_learning/3]).
|
||||
|
||||
|
||||
% load library modules
|
||||
:- use_module(library(system)).
|
||||
|
||||
% load our own modules
|
||||
:- use_module(flags).
|
||||
|
||||
|
|
|
@ -214,12 +214,12 @@
|
|||
|
||||
:- use_module(library(random)).
|
||||
|
||||
:- problog_define_flag(mc_batchsize, problog_flag_validate_posint, 'number of samples before update in montecarlo', 1000, monte_carlo_sampling).
|
||||
|
||||
:- problog_define_flag(min_mc_samples, problog_flag_validate_nonegint, 'minimum number of samples before to converge', 0, monte_carlo_sampling).
|
||||
:- problog_define_flag(max_mc_samples, problog_flag_validate_nonegint, 'maximum number of samples waiting to converge', 1000000, monte_carlo_sampling).
|
||||
|
||||
:- problog_define_flag(randomizer, problog_flag_validate_in_list([repeatable, nonrepeatable]), 'whether the random numbers are repeatable or not', repeatable, monte_carlo_sampling).
|
||||
:- initialization((
|
||||
problog_define_flag(mc_batchsize, problog_flag_validate_posint, 'number of samples before update in montecarlo', 1000, monte_carlo_sampling),
|
||||
problog_define_flag(min_mc_samples, problog_flag_validate_nonegint, 'minimum number of samples before to converge', 0, monte_carlo_sampling),
|
||||
problog_define_flag(max_mc_samples, problog_flag_validate_nonegint, 'maximum number of samples waiting to converge', 1000000, monte_carlo_sampling),
|
||||
problog_define_flag(randomizer, problog_flag_validate_in_list([repeatable, nonrepeatable]), 'whether the random numbers are repeatable or not', repeatable, monte_carlo_sampling)
|
||||
)).
|
||||
|
||||
problog_convergence_check(Time, P, SamplesSoFar, Delta, Epsilon, Converged):-
|
||||
Epsilon is 2.0 * sqrt(P * abs(1.0 - P) / SamplesSoFar),
|
||||
|
|
|
@ -233,7 +233,7 @@
|
|||
problog_tabling_get_negated_from_id/2,
|
||||
op(1150, fx, problog_table)]).
|
||||
|
||||
:- use_module(library(lists)).
|
||||
:- use_module(library(lists)). % not necessary?
|
||||
|
||||
:- use_module(extlists, _, [open_end_memberchk/2,
|
||||
open_end_add/3,
|
||||
|
@ -248,11 +248,18 @@
|
|||
empty_ptree/1]).
|
||||
|
||||
:- op( 1150, fx, problog_table ).
|
||||
|
||||
:- meta_predicate(problog_table(0)).
|
||||
:- meta_predicate(problog_neg(0)).
|
||||
:- dynamic problog_tabled/1, has_synonyms/0, problog_tabling_retain/1.
|
||||
:- problog_define_flag(max_depth, problog_flag_validate_integer, 'maximum proof depth', -1).
|
||||
:- problog_define_flag(retain_tables, problog_flag_validate_boolean, 'retain tables after query', false).
|
||||
|
||||
:- dynamic(problog_tabled/1).
|
||||
:- dynamic(has_synonyms/0).
|
||||
:- dynamic(problog_tabling_retain/1).
|
||||
|
||||
:- initialization((
|
||||
problog_define_flag(max_depth, problog_flag_validate_integer, 'maximum proof depth', -1),
|
||||
problog_define_flag(retain_tables, problog_flag_validate_boolean, 'retain tables after query', false)
|
||||
)).
|
||||
|
||||
init_tabling :-
|
||||
nb_setval(problog_current_depth, 0),
|
||||
|
|
|
@ -214,8 +214,8 @@
|
|||
:- yap_flag(unknown,error).
|
||||
:- style_check(single_var).
|
||||
|
||||
:- dynamic timer/2.
|
||||
:- dynamic timer_paused/2.
|
||||
:- dynamic(timer/2).
|
||||
:- dynamic(timer_paused/2).
|
||||
|
||||
|
||||
timer_start(Name) :-
|
||||
|
|
|
@ -259,28 +259,32 @@
|
|||
|
||||
|
||||
% this is a test to determine whether YAP provides the needed trie library
|
||||
:- current_predicate(tries:trie_disable_hash/0)
|
||||
->
|
||||
trie_disable_hash;
|
||||
print_message(warning,'The predicate tries:trie_disable_hash/0 does not exist. Please update trie library.').
|
||||
:- initialization(
|
||||
( current_predicate(tries:trie_disable_hash/0) ->
|
||||
trie_disable_hash
|
||||
; print_message(warning,'The predicate tries:trie_disable_hash/0 does not exist. Please update trie library.')
|
||||
)
|
||||
).
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Define module flags
|
||||
%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
:- problog_define_flag(use_db_trie, problog_flag_validate_boolean, 'use the builtin trie 2 trie transformation', false).
|
||||
:- problog_define_flag(db_trie_opt_lvl, problog_flag_validate_integer, 'optimization level for the trie 2 trie transformation', 0).
|
||||
:- problog_define_flag(compare_opt_lvl, problog_flag_validate_boolean, 'comparison mode for optimization level', false).
|
||||
:- problog_define_flag(db_min_prefix, problog_flag_validate_integer, 'minimum size of prefix for dbtrie to optimize', 2).
|
||||
:- problog_define_flag(use_naive_trie, problog_flag_validate_boolean, 'use the naive algorithm to generate bdd scripts', false).
|
||||
:- problog_define_flag(use_old_trie, problog_flag_validate_boolean, 'use the old trie 2 trie transformation no nested', true).
|
||||
:- problog_define_flag(use_dec_trie, problog_flag_validate_boolean, 'use the decomposition method', false).
|
||||
:- problog_define_flag(subset_check, problog_flag_validate_boolean, 'perform subset check in nested tries', true).
|
||||
:- problog_define_flag(deref_terms, problog_flag_validate_boolean, 'deref BDD terms after last use', false).
|
||||
|
||||
:- problog_define_flag(trie_preprocess, problog_flag_validate_boolean, 'perform a preprocess step to nested tries', false).
|
||||
:- problog_define_flag(refine_anclst, problog_flag_validate_boolean, 'refine the ancestor list with their childs', false).
|
||||
:- problog_define_flag(anclst_represent,problog_flag_validate_in_list([list, integer]), 'represent the ancestor list', list).
|
||||
:- initialization((
|
||||
problog_define_flag(use_db_trie, problog_flag_validate_boolean, 'use the builtin trie 2 trie transformation', false),
|
||||
problog_define_flag(db_trie_opt_lvl, problog_flag_validate_integer, 'optimization level for the trie 2 trie transformation', 0),
|
||||
problog_define_flag(compare_opt_lvl, problog_flag_validate_boolean, 'comparison mode for optimization level', false),
|
||||
problog_define_flag(db_min_prefix, problog_flag_validate_integer, 'minimum size of prefix for dbtrie to optimize', 2),
|
||||
problog_define_flag(use_naive_trie, problog_flag_validate_boolean, 'use the naive algorithm to generate bdd scripts', false),
|
||||
problog_define_flag(use_old_trie, problog_flag_validate_boolean, 'use the old trie 2 trie transformation no nested', true),
|
||||
problog_define_flag(use_dec_trie, problog_flag_validate_boolean, 'use the decomposition method', false),
|
||||
problog_define_flag(subset_check, problog_flag_validate_boolean, 'perform subset check in nested tries', true),
|
||||
problog_define_flag(deref_terms, problog_flag_validate_boolean, 'deref BDD terms after last use', false),
|
||||
|
||||
problog_define_flag(trie_preprocess, problog_flag_validate_boolean, 'perform a preprocess step to nested tries', false),
|
||||
problog_define_flag(refine_anclst, problog_flag_validate_boolean, 'refine the ancestor list with their childs', false),
|
||||
problog_define_flag(anclst_represent,problog_flag_validate_in_list([list, integer]), 'represent the ancestor list', list)
|
||||
)).
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -419,7 +423,7 @@ merge_ptree(T1, T2, T3) :-
|
|||
% - ptree_decomposition -> ptree_decomposition_struct
|
||||
% - bdd_ptree_script -> bdd_struct_ptree_script
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
:- dynamic c_num/1.
|
||||
:- dynamic(c_num/1).
|
||||
|
||||
bdd_struct_ptree(Trie, FileBDD, Variables) :-
|
||||
bdd_struct_ptree_script(Trie, FileBDD, Variables),
|
||||
|
@ -1018,7 +1022,7 @@ statistics_ptree:-
|
|||
write('--------------------------------'),nl.
|
||||
|
||||
|
||||
:- dynamic nested_ptree_printed/1.
|
||||
:- dynamic(nested_ptree_printed/1).
|
||||
|
||||
print_nested_ptree(Trie):-
|
||||
retractall(nested_ptree_printed(_)),
|
||||
|
@ -1987,7 +1991,7 @@ ptree_db_trie_opt_performed(LVL1, LVL2, LVL3):-
|
|||
trie_get_depth_breadth_reduction_opt_level_count(2, LVL2),
|
||||
trie_get_depth_breadth_reduction_opt_level_count(3, LVL3).
|
||||
|
||||
:- dynamic deref/2.
|
||||
:- dynamic(deref/2).
|
||||
|
||||
mark_for_deref(DB_Trie):-
|
||||
traverse_ptree_mode(OLD),
|
||||
|
|
|
@ -212,10 +212,13 @@
|
|||
delete_file_silent/1
|
||||
]).
|
||||
|
||||
% switch on all tests to reduce bug searching time
|
||||
:- style_check(all).
|
||||
:- yap_flag(unknown,error).
|
||||
|
||||
% load library modules
|
||||
:- use_module(library(lists)).
|
||||
:- use_module(library(system)).
|
||||
:- use_module(library(lists), [append/3, member/2]).
|
||||
:- use_module(library(system), [delete_file/1, directory_files/2, file_exists/1]).
|
||||
|
||||
% load our own modules
|
||||
:- use_module(os).
|
||||
|
|
|
@ -204,7 +204,12 @@
|
|||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
:- 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)).
|
||||
:- use_module(library(tries)).
|
||||
|
@ -212,10 +217,10 @@
|
|||
:- use_module('flags', _, [problog_define_flag/5]).
|
||||
|
||||
|
||||
:- nb_setval(prob_fact_count, 0).
|
||||
|
||||
:- problog_define_flag(variable_elimination, problog_flag_validate_boolean, 'enable variable elimination', false, variable_elimination).
|
||||
|
||||
:- initialization((
|
||||
nb_setval(prob_fact_count, 0),
|
||||
problog_define_flag(variable_elimination, problog_flag_validate_boolean, 'enable variable elimination', false, variable_elimination)
|
||||
)).
|
||||
|
||||
bit_encode(L, ON):-
|
||||
bit_encode(L, ON, 0).
|
||||
|
@ -386,7 +391,7 @@ replace([], _, _, []).
|
|||
replace([H|T], H, NH, [NH|NT]):-
|
||||
replace(T, H, NH, NT).
|
||||
replace([H|T], R, NR, [H|NT]):-
|
||||
\+ H == R,
|
||||
H \== R,
|
||||
replace(T, R, NR, NT).
|
||||
|
||||
clean_up:-
|
||||
|
|
Reference in New Issue