2012-03-22 19:10:15 +00:00
|
|
|
|
2012-03-31 23:27:37 +01:00
|
|
|
/*******************************************************
|
|
|
|
|
|
|
|
Interface with C++
|
|
|
|
|
|
|
|
********************************************************/
|
|
|
|
|
2012-03-22 19:10:15 +00:00
|
|
|
:- module(clpbn_horus,
|
2012-04-11 19:15:52 +01:00
|
|
|
[set_solver/1,
|
|
|
|
create_lifted_network/3,
|
2012-04-05 18:38:56 +01:00
|
|
|
create_ground_network/4,
|
2012-03-31 23:27:37 +01:00
|
|
|
set_parfactors_params/2,
|
2012-04-10 12:53:52 +01:00
|
|
|
set_factors_params/2,
|
2012-03-31 23:27:37 +01:00
|
|
|
run_lifted_solver/3,
|
|
|
|
run_ground_solver/3,
|
2012-04-09 15:40:51 +01:00
|
|
|
set_vars_information/2,
|
2012-03-31 23:27:37 +01:00
|
|
|
set_horus_flag/2,
|
|
|
|
free_parfactors/1,
|
2012-04-03 19:53:27 +01:00
|
|
|
free_ground_network/1
|
2012-03-31 23:27:37 +01:00
|
|
|
]).
|
|
|
|
|
2012-03-22 19:10:15 +00:00
|
|
|
|
2012-04-11 19:15:52 +01:00
|
|
|
|
2012-04-03 15:01:35 +01:00
|
|
|
patch_things_up :-
|
2012-04-03 19:53:27 +01:00
|
|
|
assert_static(clpbn_horus:set_horus_flag(_,_)).
|
2012-04-03 15:01:35 +01:00
|
|
|
|
|
|
|
warning :-
|
2012-04-03 19:53:27 +01:00
|
|
|
format(user_error,"Horus library not installed: cannot use bp, fove~n.",[]).
|
2012-04-03 15:01:35 +01:00
|
|
|
|
2012-04-03 16:22:40 +01:00
|
|
|
:- catch(load_foreign_files([horus], [], init_predicates), _, patch_things_up) -> true ; warning.
|
2012-04-03 15:01:35 +01:00
|
|
|
|
|
|
|
|
2012-06-01 13:17:39 +01:00
|
|
|
set_solver(ve) :- pfl:set_pfl_flag(solver,ve).
|
|
|
|
set_solver(jt) :- pfl:set_pfl_flag(solver,jt).
|
|
|
|
set_solver(gibbs) :- pfl:set_pfl_flag(solver,gibbs).
|
|
|
|
set_solver(fove) :- pfl:set_pfl_flag(solver,fove).
|
|
|
|
set_solver(hve) :- pfl:set_pfl_flag(solver,bp), set_horus_flag(inf_alg, ve).
|
|
|
|
set_solver(bp) :- pfl:set_pfl_flag(solver,bp), set_horus_flag(inf_alg, bp).
|
|
|
|
set_solver(cbp) :- pfl:set_pfl_flag(solver,bp), set_horus_flag(inf_alg, cbp).
|
2012-04-11 19:15:52 +01:00
|
|
|
set_solver(S) :- throw(error('unknow solver ', S)).
|
|
|
|
|
|
|
|
|
|
|
|
%:- set_horus_flag(inf_alg, ve).
|
2012-04-11 15:36:50 +01:00
|
|
|
%:- set_horus_flag(inf_alg, bp).
|
2012-03-31 23:27:37 +01:00
|
|
|
%: -set_horus_flag(inf_alg, cbp).
|
|
|
|
|
|
|
|
:- set_horus_flag(schedule, seq_fixed).
|
|
|
|
%:- set_horus_flag(schedule, seq_random).
|
|
|
|
%:- set_horus_flag(schedule, parallel).
|
|
|
|
%:- set_horus_flag(schedule, max_residual).
|
|
|
|
|
|
|
|
:- set_horus_flag(accuracy, 0.0001).
|
|
|
|
|
|
|
|
:- set_horus_flag(max_iter, 1000).
|
|
|
|
|
|
|
|
:- set_horus_flag(order_factor_variables, false).
|
|
|
|
%:- set_horus_flag(order_factor_variables, true).
|
|
|
|
|
|
|
|
:- set_horus_flag(use_logarithms, false).
|
|
|
|
% :- set_horus_flag(use_logarithms, true).
|
|
|
|
|