misc_bugs_when_compiling_problog

This commit is contained in:
Vitor Santos Costa
2016-04-14 12:00:09 +01:00
parent 29fba0238d
commit 1aa20e24b7
29 changed files with 100 additions and 191 deletions

View File

@@ -187,7 +187,7 @@
% free-of-charge patent license to make, have made, use, offer to sell,
% sell, import and otherwise transfer the Package with respect to any
% patent claims licensable by the Copyright Holder that are necessarily
% infringed by the Package. If you institute patent litigation
% infringed by the Pack<age. If you institute patent litigation
% (including a cross-claim or counterclaim) against any party alleging
% that the Package constitutes direct or contributory patent
% infringement, then this Artistic License to you shall terminate on the
@@ -429,7 +429,7 @@ flag_validate_integer(Value):-
flag_validate_directory.
flag_validate_directory(Value):-
atomic(Value),
atomic(Value),
catch(file_exists(Value), _, fail),
file_property(Value, type(directory)), !.
flag_validate_directory(Value):-

View File

@@ -1,16 +0,0 @@
@x0
1.8030419430
@x1
1.5711506586
@x2
0.3874470553
@x3
0.7696186145
@x4
0.3435736975
@x5
-0.7166347511
@x6
0.9712276641
@x7
-1.4049657589

View File

@@ -730,7 +730,7 @@ update_query(QueryID,Symbol,What_To_Update) :-
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('simplecudd', Simplecudd),
convert_filename_to_problog_path('problogbdd', Simplecudd),
atomic_concat([Simplecudd,
' -i "', Probabilities_File, '"',
' -l "', Query_Directory,'/query_',QueryID, '"',

View File

@@ -353,7 +353,8 @@ do_learning_intern(Iterations,Epsilon) :-
format_learning(1,'~nIteration ~d of ~d~n',[CurrentIteration,EndIteration]),
logger_set_variable(iteration,CurrentIteration),
leash(none),
% trace,
write_probabilities_file,
once(llh_testset),
@@ -410,14 +411,14 @@ init_learning :-
learning_initialized,
!.
init_learning :-
convert_filename_to_problog_path('simplecudd_lfi', Path),
convert_filename_to_problog_path('problogbdd_lfi', Path),
(
file_exists(Path)
->
true;
(
problog_path(PD),
format(user_error, 'WARNING: Can not find file: simplecudd_lfi. Please place file in problog path: ~q~n',[PD]),
format(user_error, 'WARNING: Can not find file: problogbdd_lfi. Please place file in problog path: ~q~n',[PD]),
fail
)
),
@@ -457,7 +458,7 @@ init_learning :-
format_learning(3,'~q training example(s)~n',[TrainingExampleCount]),
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create arrays for probabilties and counting tables
% Create arrays for probabilities and counting tables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
once(initialize_fact_probabilities),
problog:probclause_id(N),
@@ -471,7 +472,6 @@ init_learning :-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% build BDD script for every example
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
once(init_queries),
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -613,10 +613,11 @@ init_queries :-
format_learning(2,'Build BDDs for examples~n',[]),
forall(user:example(Training_ID),
(
format_learning(3,'training example ~q: ',[Training_ID]),
format_learning(3,'training example ~q: ',[Training_ID]),
init_one_query(Training_ID,training)
)
),
writeln(Training_ID),
forall(
(
@@ -885,7 +886,7 @@ update_query(QueryID,ClusterID ,Method,Command,PID,Output_File_Name) :-
create_bdd_output_file_name(QueryID,ClusterID,Iteration,Output_File_Name),
create_bdd_file_name(QueryID,ClusterID,BDD_File_Name),
convert_filename_to_problog_path('simplecudd_lfi',Absolute_Name),
convert_filename_to_problog_path('problogbdd_lfi',Absolute_Name),
atomic_concat([Absolute_Name,
' -i "', Input_File_Name, '"',

View File

@@ -1438,11 +1438,11 @@ static foreign_t python_to_term(PyObject *pVal, term_t t) {
return address_to_term(pVal, t);
Py_ssize_t sz = PyUnicode_GetSize(pValR) + 1;
#if PY_MAJOR_VERSION < 3
s = malloc(sizeof(char) * sz);
char *s = malloc(sizeof(char) * sz);
PyObject *us = PyUnicode_EncodeUTF8((const Py_UNICODE *)pValR, sz, NULL);
PyString_AsStringAndSize(us, &s, &sz);
foreign_t rc = repr_term(s, sz, t);
free(s);
free((void *)s);
return rc;
#else
// new interface
@@ -2150,9 +2150,8 @@ static foreign_t python_run_script(term_t cmd, term_t fun) {
return false;
}
static foreign_t python_builtin(out) {
static foreign_t python_builtin(term_t out) {
return address_to_term(py_Builtin, out);
return true;
}
static foreign_t init_python(void) {