Merge ssh://ssh.dcc.fc.up.pt:31064//home/vsc/yap

This commit is contained in:
Vitor Santos Costa 2018-10-19 14:56:33 +01:00
commit 3786de19de
8 changed files with 16 additions and 23 deletions

View File

@ -623,6 +623,10 @@
BOp(undef_p, e); BOp(undef_p, e);
/* save S for module name */ /* save S for module name */
if (LOCAL_DoingUndefp) {
PREG=FAILCODE;
JMPNext();
}
LOCAL_DoingUndefp = true; LOCAL_DoingUndefp = true;
saveregs(); saveregs();
undef_goal(PASS_REGS1); undef_goal(PASS_REGS1);

View File

@ -977,7 +977,7 @@ PredEntry *YAPPredicate::getPred(Term &t, Term &m, CELL *&out) {
} else { } else {
ap = RepPredProp(PredPropByFunc(f, m)); ap = RepPredProp(PredPropByFunc(f, m));
if (out) if (out)
memmove(out, RepAppl(t) + 1, ap->ArityOfPE * sizeof(CELL)); memmove(out, (const CELL *)RepAppl(t) + 1, ap->ArityOfPE * sizeof(CELL));
else else
out = RepAppl(t) + 1; out = RepAppl(t) + 1;
} }

View File

@ -525,8 +525,9 @@ public:
mk(t); mk(t);
} }
} }
/// type check for unbound
bool unbound() { return IsUnboundVar(VarOfTerm(gt())); } bool unbound() { return IsUnboundVar(VarOfTerm(gt())); }
inline bool isVar() { return true; } /// type check for unbound inline bool isVar() { return true; }
inline bool isAtom() { return false; } /// type check for atom inline bool isAtom() { return false; } /// type check for atom
inline bool isInteger() { return false; } /// type check for integer inline bool isInteger() { return false; } /// type check for integer
inline bool isFloat() { return false; } /// type check for floating-point inline bool isFloat() { return false; } /// type check for floating-point

View File

@ -57,7 +57,7 @@
with the `use_module(library(lists))` command. with the `use_module(library(lists))` command.
*/ */
:- include(pl/bootlists). %:- include(pl/bootlists).
/** @pred list_concat(+ _Lists_,? _List_) /** @pred list_concat(+ _Lists_,? _List_)

View File

@ -703,7 +703,7 @@ ground_truth_difference :-
%= -Float %= -Float
%======================================================================== %========================================================================
mse_trainingset_only_for_linesearch(MSE) :- mse_trainingset_only_for_linesearch(MSE, FX) :-
update_values, update_values,
example_count(Example_Count), example_count(Example_Count),
@ -712,21 +712,8 @@ mse_trainingset_only_for_linesearch(MSE) :-
forall(user:example(QueryID,_Query,QueryProb,Type), forall(user:example(QueryID,_Query,QueryProb,Type),
( (
once(update_query(QueryID,'.',probability)), once(update_query(QueryID,'.',probability)),
query_probability(QueryID,CurrentProb),
once(update_query_cleanup(QueryID)), once(update_query_cleanup(QueryID)),
( ),
(Type == '='; (Type == '<', CurrentProb>QueryProb); (Type=='>',CurrentProb<QueryProb))
->
(
bb_get(error_train_line_search,Old_Error),
New_Error is Old_Error + (CurrentProb-QueryProb)**2,
bb_put(error_train_line_search,New_Error)
);true
)
)
),
bb_delete(error_train_line_search,Error),
MSE is Error/Example_Count,
format_learning(3,' (~8f)~n',[MSE]), format_learning(3,' (~8f)~n',[MSE]),
retractall(values_correct). retractall(values_correct).
@ -842,7 +829,7 @@ set_tunable(I,Slope,P) :-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% start calculate gradient % start calculate gradient
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
user:evaluate(LLH_Training_Queries, X,Grad,N,_,_) :- user:evaluate(LLH_Training_Queries, X,Grad,N,_,_) :-
%Handle = user_error, %Handle = user_error,
example_count(TrainingExampleCount), example_count(TrainingExampleCount),
@ -984,7 +971,7 @@ user:progress(FX,X,_G,X_Norm,G_Norm,Step,_N,Iteration,Ls,0) :-
NextIteration is CurrentIteration+1, NextIteration is CurrentIteration+1,
assertz(current_iteration(NextIteration)), assertz(current_iteration(NextIteration)),
save_model, save_model,
set_problog_flag(mse_trainset, FX), set_problog_flag(mse_trainingset, FX),
X0 <== X[0], sigmoid(X0,Slope,P0), X0 <== X[0], sigmoid(X0,Slope,P0),
X1 <== X[1], sigmoid(X1,Slope,P1), X1 <== X[1], sigmoid(X1,Slope,P1),
format('~d. Iteration : (x0,x1)=(~4f,~4f) f(X)=~4f |X|=~4f |X\'|=~4f Step=~4f Ls=~4f~n',[Iteration,P0 ,P1,FX,X_Norm,G_Norm,Step,Ls]). format('~d. Iteration : (x0,x1)=(~4f,~4f) f(X)=~4f |X|=~4f |X\'|=~4f Step=~4f Ls=~4f~n',[Iteration,P0 ,P1,FX,X_Norm,G_Norm,Step,Ls]).

View File

@ -640,7 +640,7 @@ static JNIEnv*
jni_env(void) /* economically gets a JNIEnv pointer, valid for this thread */ jni_env(void) /* economically gets a JNIEnv pointer, valid for this thread */
{ JNIEnv *env; { JNIEnv *env;
switch( (*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_1_8) ) switch( (*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_1_4) )
{ case JNI_OK: { case JNI_OK:
return env; return env;
case JNI_EDETACHED: case JNI_EDETACHED:
@ -5675,7 +5675,7 @@ static foreign_t
int i; int i;
term_t head; term_t head;
term_t list; term_t list;
char *s; char *s = NULL;
if ( jvm_dia == NULL ) /* presumably, JVM is already started, so default options cannot now be set */ if ( jvm_dia == NULL ) /* presumably, JVM is already started, so default options cannot now be set */
{ {

View File

@ -166,7 +166,7 @@ listing(Stream, [MV|MVs]) :- !,
-> ->
format( Stream, ':- dynamic ~q/~d.~n', [N,Ar]) format( Stream, ':- dynamic ~q/~d.~n', [N,Ar])
; ;
\ format( Stream, ':- dynamic ~q:~q/~d.~n', [M,N,Ar]) format( Stream, ':- dynamic ~q:~q/~d.~n', [M,N,Ar])
), ),
fail. fail.
'$list_clauses'(Stream, M, Pred) :- '$list_clauses'(Stream, M, Pred) :-

View File

@ -49,6 +49,7 @@ prolog:'$protect' :-
sub_atom(Name,0,1,_, '$'), sub_atom(Name,0,1,_, '$'),
functor(P,Name,Arity), functor(P,Name,Arity),
% '$hide_predicate'(P,M), % '$hide_predicate'(P,M),
'$stash_predicate'(P,M),
fail. fail.
prolog:'$protect' :- prolog:'$protect' :-
current_atom(Name), current_atom(Name),