This commit is contained in:
Vitor Santos Costa 2013-07-29 17:55:51 -05:00
parent 3bb50ce3af
commit bfb4cef8f9
2 changed files with 14 additions and 9 deletions

View File

@ -91,9 +91,9 @@ optimizer_parameters :-
optimizer_get_parameter(orthantwise_start,Orthantwise_Start),
optimizer_get_parameter(orthantwise_end,Orthantwise_End),
format('==========================================================================================~n',[]),
format('/******************************************************************************************~n',[]),
print_param('Name','Value','Description','Type'),
format('==========================================================================================~n',[]),
format('******************************************************************************************~n',[]),
print_param(m,M,'The number of corrections to approximate the inverse hessian matrix.',int),
print_param(epsilon,Epsilon,'Epsilon for convergence test.',float),
print_param(past,Past,'Distance for delta-based convergence test.',int),
@ -109,7 +109,7 @@ optimizer_parameters :-
print_param(orthantwise_c,Orthantwise_C,'Coefficient for the L1 norm of variables',float),
print_param(orthantwise_start,Orthantwise_Start,'Start index for computing the L1 norm of the variables.',int),
print_param(orthantwise_end,Orthantwise_End,'End index for computing the L1 norm of the variables.',int),
format('==========================================================================================~n',[]),
format('******************************************************************************************/~n',[]),
format(' use optimizer_set_paramater(Name,Value) to change parameters~n',[]),
format(' use optimizer_get_parameter(Name,Value) to see current parameters~n',[]),
format(' use optimizer_parameters to print this overview~2n',[]).

View File

@ -30,7 +30,7 @@
#define OPTIMIZER_STATUS_CB_EVAL 3
#define OPTIMIZER_STATUS_CB_PROGRESS 4
void init_lbfgs_predicates( void ) ;
int optimizer_status=OPTIMIZER_STATUS_NONE; // the internal state
int n; // the size of the parameter vector
@ -50,6 +50,7 @@ static lbfgsfloatval_t evaluate(
)
{
YAP_Term call;
YAP_Term a1;
YAP_Bool result;
YAP_Int s1;
@ -75,11 +76,15 @@ static lbfgsfloatval_t evaluate(
}
call = YAP_GetFromSlot( s1 );
if (YAP_IsFloatTerm(YAP_ArgOfTerm(1,call))) {
return (lbfgsfloatval_t) YAP_FloatOfTerm(YAP_ArgOfTerm(1,call));
} else if (YAP_IsIntTerm(YAP_ArgOfTerm(1,call))) {
return (lbfgsfloatval_t) YAP_IntOfTerm(YAP_ArgOfTerm(1,call));
}
a1 = YAP_ArgOfTerm(1,call);
if (YAP_IsFloatTerm(a1)) {
YAP_ShutdownGoal( TRUE );
return (lbfgsfloatval_t) YAP_FloatOfTerm(a1);
} else if (YAP_IsIntTerm(a1)) {
YAP_ShutdownGoal( TRUE );
return (lbfgsfloatval_t) YAP_IntOfTerm(a1);
}
YAP_ShutdownGoal( TRUE );
fprintf(stderr, "ERROR: The evaluate call back function did not return a number as first argument.\n");