Reorders and some reindentation

This commit is contained in:
Tiago Gomes
2012-12-17 11:53:57 +00:00
parent 9ff9be2f49
commit e35cf51476
7 changed files with 263 additions and 247 deletions

View File

@@ -1,30 +1,31 @@
%
% This module defines PFL, the prolog factor language.
% This module defines PFL, the Prolog Factor Language.
%
%
:- module(pfl, [
op(550,yfx,@),
op(550,yfx,::),
op(1150,fx,bayes),
op(1150,fx,markov),
factor/6,
skolem/2,
defined_in_factor/2,
get_pfl_cpt/5, % given id and keys, return new keys and cpt
get_pfl_parameters/2, % given id return par factor parameter
new_pfl_parameters/2, % given id set new parameters
get_first_pvariable/2, % given id get firt pvar (useful in bayesian)
get_factor_pvariable/2, % given id get any pvar
add_ground_factor/5 %add a new bayesian variable (for now)
]).
:- module(pfl,
[op(550,yfx,@),
op(550,yfx,::),
op(1150,fx,bayes),
op(1150,fx,markov),
factor/6,
skolem/2,
defined_in_factor/2,
get_pfl_cpt/5, % given id and keys, return new keys and cpt
get_pfl_parameters/2, % given id return par factor parameter
new_pfl_parameters/2, % given id set new parameters
get_first_pvariable/2, % given id get firt pvar (useful in bayesian)
get_factor_pvariable/2, % given id get any pvar
add_ground_factor/5 %add a new bayesian variable (for now)
]).
:- reexport(library(clpbn),
[clpbn_flag/2 as pfl_flag,
set_clpbn_flag/2 as set_pfl_flag,
conditional_probability/3,
pfl_init_solver/5,
pfl_run_solver/3]).
pfl_run_solver/3
]).
:- reexport(library(clpbn/horus),
[set_solver/1]).
@@ -32,24 +33,25 @@
:- reexport(library(clpbn/aggregates),
[avg_factors/5]).
:- ( % if clp(bn) has done loading, we're top-level
predicate_property(set_pfl_flag(_,_), imported_from(clpbn))
->
->
% we're using factor language
% set appropriate flag
set_pfl_flag(use_factors,on)
;
;
% we're within clp(bn), no need to do anything
true
).
).
:- use_module(library(atts)).
:- use_module(library(lists),
[nth0/3,
append/3,
member/2]).
member/2
]).
:- dynamic factor/6, skolem_in/2, skolem/2, preprocess/3, evidence/2, id/1.
user:term_expansion( bayes((Formula ; Phi ; Constraints)), pfl:factor(bayes,Id,FList,FV,Phi,Constraints)) :-