2012-03-31 23:27:37 +01:00
|
|
|
/*******************************************************
|
|
|
|
|
2012-05-23 19:15:23 +01:00
|
|
|
Horus Interface
|
2012-03-31 23:27:37 +01:00
|
|
|
|
|
|
|
********************************************************/
|
|
|
|
|
2012-03-22 19:10:15 +00:00
|
|
|
:- module(clpbn_horus,
|
2012-04-11 19:15:52 +01:00
|
|
|
[set_solver/1,
|
2012-05-23 20:34:57 +01:00
|
|
|
set_horus_flag/1,
|
|
|
|
cpp_create_lifted_network/3,
|
2012-05-23 21:23:03 +01:00
|
|
|
cpp_create_ground_network/4,
|
2012-05-23 20:34:57 +01:00
|
|
|
cpp_set_parfactors_params/2,
|
|
|
|
cpp_set_factors_params/2,
|
|
|
|
cpp_run_lifted_solver/3,
|
|
|
|
cpp_run_ground_solver/3,
|
|
|
|
cpp_set_vars_information/2,
|
|
|
|
cpp_set_horus_flag/2,
|
2012-06-19 15:29:09 +01:00
|
|
|
cpp_free_lifted_network/1,
|
2012-05-23 20:34:57 +01:00
|
|
|
cpp_free_ground_network/1
|
2012-03-31 23:27:37 +01:00
|
|
|
]).
|
|
|
|
|
2012-06-04 16:29:56 +01:00
|
|
|
:- use_module(library(clpbn),
|
|
|
|
[set_clpbn_flag/2]).
|
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-05-23 20:34:57 +01:00
|
|
|
assert_static(clpbn_horus:cpp_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-18 03:03:29 +01:00
|
|
|
|
|
|
|
:- catch(load_foreign_files([horus], [], init_predicates), _, patch_things_up)
|
|
|
|
-> true ; warning.
|
2012-04-03 15:01:35 +01:00
|
|
|
|
|
|
|
|
2012-09-29 11:50:00 +01:00
|
|
|
set_solver(ve) :- !, set_clpbn_flag(solver,ve).
|
|
|
|
set_solver(bdd) :- !, set_clpbn_flag(solver,bdd).
|
|
|
|
set_solver(jt) :- !, set_clpbn_flag(solver,jt).
|
|
|
|
set_solver(gibbs) :- !, set_clpbn_flag(solver,gibbs).
|
2012-11-08 15:05:48 +00:00
|
|
|
set_solver(lve) :- !, set_clpbn_flag(solver,fove), set_horus_flag(lifted_solver, lve).
|
2012-09-29 11:50:00 +01:00
|
|
|
set_solver(lbp) :- !, set_clpbn_flag(solver,fove), set_horus_flag(lifted_solver, lbp).
|
2012-11-08 15:05:48 +00:00
|
|
|
set_solver(lkc) :- !, set_clpbn_flag(solver,fove), set_horus_flag(lifted_solver, lkc).
|
2012-09-29 11:50:00 +01:00
|
|
|
set_solver(hve) :- !, set_clpbn_flag(solver,bp), set_horus_flag(ground_solver, ve).
|
|
|
|
set_solver(bp) :- !, set_clpbn_flag(solver,bp), set_horus_flag(ground_solver, bp).
|
|
|
|
set_solver(cbp) :- !, set_clpbn_flag(solver,bp), set_horus_flag(ground_solver, cbp).
|
2012-09-24 14:36:30 +01:00
|
|
|
set_solver(S) :- throw(error('unknown solver ', S)).
|
2012-04-11 19:15:52 +01:00
|
|
|
|
|
|
|
|
2012-05-23 20:34:57 +01:00
|
|
|
set_horus_flag(K,V) :- cpp_set_horus_flag(K,V).
|
2012-03-31 23:27:37 +01:00
|
|
|
|
|
|
|
|
2012-05-23 20:34:57 +01:00
|
|
|
:- cpp_set_horus_flag(schedule, seq_fixed).
|
|
|
|
%:- cpp_set_horus_flag(schedule, seq_random).
|
|
|
|
%:- cpp_set_horus_flag(schedule, parallel).
|
|
|
|
%:- cpp_set_horus_flag(schedule, max_residual).
|
2012-03-31 23:27:37 +01:00
|
|
|
|
2012-05-23 20:34:57 +01:00
|
|
|
:- cpp_set_horus_flag(accuracy, 0.0001).
|
2012-03-31 23:27:37 +01:00
|
|
|
|
2012-05-23 20:34:57 +01:00
|
|
|
:- cpp_set_horus_flag(max_iter, 1000).
|
2012-03-31 23:27:37 +01:00
|
|
|
|
2012-05-23 20:34:57 +01:00
|
|
|
:- cpp_set_horus_flag(use_logarithms, false).
|
|
|
|
% :- cpp_set_horus_flag(use_logarithms, true).
|
2012-03-31 23:27:37 +01:00
|
|
|
|