fixes in simplecudd & lbdd
This commit is contained in:
parent
f7c3aef830
commit
5fd4413ffd
|
@ -269,8 +269,9 @@
|
|||
problog_define_flag(compensate_unused, problog_flag_validate_boolean, 'compensate non-neutral sum for unused facts', false, aproblog)
|
||||
)).
|
||||
|
||||
% directory where problogbdd executable is located
|
||||
% directory where simplecudd executable is located
|
||||
% automatically set during loading -- assumes it is in same place as this file (problog.yap)
|
||||
%:- PD = /usr/local/bin, set_problog_path(PD).
|
||||
:- getcwd(PD), set_problog_path(PD).
|
||||
|
||||
aproblog_flag(F,V) :-
|
||||
|
|
|
@ -698,7 +698,7 @@ bdd_optimization(N,EV,Decisions,Status) :-
|
|||
;
|
||||
Param = ParamD
|
||||
),
|
||||
convert_filename_to_problog_path('problogbdd', ProblogBDD),
|
||||
convert_filename_to_problog_path('simplecudd', ProblogBDD),
|
||||
problog_flag(bdd_result,ResultFileFlag),
|
||||
convert_filename_to_working_path(ResultFileFlag, ResultFile),
|
||||
bdd_util_file(UtilFile),
|
||||
|
|
|
@ -287,7 +287,7 @@ Instead of probabilities every fact has a t( ) prefix. The t stands for tunable
|
|||
~~~~
|
||||
t(0.5)::heads(_).
|
||||
~~~~
|
||||
*/
|
||||
*
|
||||
|
||||
/** @defgroup ProbLogPredicates ProbLog Predicates
|
||||
@ingroup ProbLog1
|
||||
|
@ -301,7 +301,6 @@ In the description of the arguments of functors the following notation will be u
|
|||
+ an argument with no preceding symbol can be used in both ways
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @pred problog_max(+G, -Prob, -FactsUsed)
|
||||
|
@ -900,12 +899,16 @@ The possible values for this flag are any number greater than zero.
|
|||
|
||||
:- multifile(user:term_expansion/1).
|
||||
|
||||
% directory where problogbdd executable is located
|
||||
% automatically set during loading -- assumes it is in same place as this file (problog.yap)
|
||||
% directory where simplecudd executable is located
|
||||
% automatically set during loading -- assumes it is in /usr/local/bin or same place where YAP has
|
||||
% been installed.)
|
||||
:- getcwd(PD0),
|
||||
atom_concat(PD0, '../../bin', PD),
|
||||
set_problog_path(PD).
|
||||
|
||||
:- PD = '/usr/local/bin',
|
||||
set_problog_path(PD).
|
||||
|
||||
|
||||
|
||||
%%%%%%%%%%%%
|
||||
|
@ -949,7 +952,7 @@ The possible values for this flag are any number greater than zero.
|
|||
%%%%%%%%%%%%
|
||||
|
||||
:- initialization((
|
||||
% problog_define_flag(bdd_path, problog_flag_validate_directory, 'problogbdd directory', '.',bdd),
|
||||
% problog_define_flag(bdd_path, problog_flag_validate_directory, 'simplecudd directory', '.',bdd),
|
||||
problog_define_flag(bdd_time, problog_flag_validate_posint, 'BDD computation timeout in seconds', 60, bdd),
|
||||
problog_define_flag(save_bdd, problog_flag_validate_boolean, 'save BDD files for (last) lower bound', false, bdd),
|
||||
problog_define_flag(dynamic_reorder, problog_flag_validate_boolean, 'use dynamic re-ordering for BDD', true, bdd),
|
||||
|
|
|
@ -302,7 +302,7 @@ term_expansion_intern_ad((Head<--Body), Module, Mode, [user:ad_intern((Head<--Bo
|
|||
).
|
||||
|
||||
term_expansion_intern_ad( (Head<--Body),_,_) :-
|
||||
format(chars(Error), 'Error at compiling the annotated disjunction ~q<--Body.',[Head,Body]),
|
||||
format(chars(Error), 'Error at compiling the annotated disjunction ~q<--~qb.',[Head,Body]),
|
||||
print_message(error,Error),
|
||||
fail.
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Prolog interface for problogbdd
|
||||
% Prolog interface for simplecudd
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
:-use_module(library(system)).
|
||||
|
@ -212,14 +212,14 @@
|
|||
|
||||
bdd_init(FDO, PID):-
|
||||
pid(MYPID),
|
||||
convert_filename_to_problog_path('problogbdd', ProblogBDD),
|
||||
atomic_concat([ProblogBDD, ' -o -pid ', MYPID], C),
|
||||
convert_filename_to_problog_path('simplecudd', Simplecudd),
|
||||
atomic_concat([Simplecudd, ' -o -pid ', MYPID], C),
|
||||
exec(C, [pipe(FDO), std, std], PID).
|
||||
|
||||
bdd_init(FDO, FDI, PID):-
|
||||
pid(MYPID),
|
||||
convert_filename_to_problog_path('problogbdd', ProblogBDD),
|
||||
atomic_concat([ProblogBDD, ' -o -m o -pid ', MYPID], C),
|
||||
convert_filename_to_problog_path('simplecudd', Simplecudd),
|
||||
atomic_concat([Simplecudd, ' -o -m o -pid ', MYPID], C),
|
||||
exec(C, [pipe(FDO), pipe(FDI), std], PID).
|
||||
|
||||
bdd_commit(FDO, LINE):-
|
||||
|
|
|
@ -321,7 +321,7 @@ get_codes(_, LF, LF).
|
|||
%========================================================================
|
||||
|
||||
|
||||
check_existance(FileName):-
|
||||
check_existance(FileName):-
|
||||
convert_filename_to_problog_path(FileName, Path),
|
||||
catch(file_exists(Path), _, fail), !.
|
||||
check_existance(FileName):-
|
||||
|
@ -334,5 +334,6 @@ path_grouping(PathSep) :-
|
|||
|
||||
path_separator('\\') :-
|
||||
current_prolog_flag( windows, true ).
|
||||
path_separator('/').
|
||||
path_separator('/').
|
||||
|
||||
|
|
@ -538,9 +538,9 @@ init_learning :-
|
|||
format_learning(3,'~q training examples~n',[TrainingExampleCount]),
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% set learning rate and alpha
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
(
|
||||
problog_flag(learning_rate,examples)
|
||||
->
|
||||
|
@ -552,7 +552,9 @@ init_learning :-
|
|||
problog_flag(alpha,auto)
|
||||
->
|
||||
(
|
||||
(user:example(_,_,P,_),P<1,P>0)
|
||||
user:example(_,_,P,_),
|
||||
P<1,
|
||||
P>0
|
||||
->
|
||||
set_problog_flag(alpha,1.0);
|
||||
(
|
||||
|
@ -603,8 +605,7 @@ init_one_query(QueryID,Query,Type) :-
|
|||
|
||||
atomic_concat(['query_',QueryID],Filename1),
|
||||
concat_path_with_filename(Query_Directory,Filename1,Filename),
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% if BDD file does not exist, call ProbLog
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
(
|
||||
|
@ -618,7 +619,7 @@ init_one_query(QueryID,Query,Type) :-
|
|||
)
|
||||
),
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% check wether this BDD is similar to another BDD
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
(
|
||||
|
@ -728,9 +729,8 @@ update_query(QueryID,Symbol,What_To_Update) :-
|
|||
format_learning(4,'#',[]);
|
||||
(
|
||||
problog_flag(sigmoid_slope,Slope),
|
||||
problog_dir(PD),
|
||||
((What_To_Update=all;query_is_similar(_,QueryID)) -> Method='g' ; Method='l'),
|
||||
convert_filename_to_problog_path('problogbdd', Simplecudd),
|
||||
convert_filename_to_problog_path('simplecudd', Simplecudd),
|
||||
atomic_concat([Simplecudd,
|
||||
' -i "', Probabilities_File, '"',
|
||||
' -l "', Query_Directory,'/query_',QueryID, '"',
|
||||
|
|
|
@ -409,14 +409,14 @@ init_learning :-
|
|||
learning_initialized,
|
||||
!.
|
||||
init_learning :-
|
||||
convert_filename_to_problog_path('problogbdd_lfi', Path),
|
||||
convert_filename_to_problog_path('simplecudd_lfi', Path),
|
||||
(
|
||||
file_exists(Path)
|
||||
->
|
||||
true;
|
||||
(
|
||||
problog_path(PD),
|
||||
format(user_error, 'WARNING: Can not find file: problogbdd_lfi. Please place file in problog path: ~q~n',[PD]),
|
||||
format(user_error, 'WARNING: Can not find file: simplecudd_lfi. Please place file in problog path: ~q~n',[PD]),
|
||||
fail
|
||||
)
|
||||
),
|
||||
|
|
Reference in New Issue