a file bug
This commit is contained in:
parent
5d2f7adb87
commit
639fc74145
@ -475,6 +475,15 @@ init_global_params :-
|
||||
tmpnam(TempFolder),
|
||||
atomic_concat([TempFolder, '_problog'], TempProblogFolder),
|
||||
problog_define_flag(dir, problog_flag_validate_directory, 'directory for files', TempProblogFolder, output),
|
||||
problog_define_flag(bdd_par_file, problog_flag_validate_file, 'file for BDD variable parameters', example_bdd_probs, bdd, flags:working_file_handler),
|
||||
problog_define_flag(bdd_result, problog_flag_validate_file, 'file to store result calculated from BDD', example_bdd_res, bdd, flags:working_file_handler),
|
||||
problog_define_flag(bdd_file, problog_flag_validate_file, 'file for BDD script', example_bdd, bdd, flags:bdd_file_handler),
|
||||
problog_define_flag(static_order_file, problog_flag_validate_file, 'file for BDD static order', example_bdd_order, bdd, flags:working_file_handler),
|
||||
%%%%%%%%%%%%
|
||||
% montecarlo: recalculate current approximation after N samples
|
||||
% montecarlo: write log to this file
|
||||
%%%%%%%%%%%%
|
||||
problog_define_flag(mc_logfile, problog_flag_validate_file, 'logfile for montecarlo', 'log.txt', mcmc, flags:working_file_handler),
|
||||
check_existance('problogbdd').
|
||||
|
||||
check_existance(FileName):-
|
||||
@ -488,18 +497,6 @@ check_existance(FileName):-
|
||||
% parameter initialization to be called after returning to user's directory:
|
||||
:- initialization(init_global_params).
|
||||
|
||||
:- problog_define_flag(bdd_par_file, problog_flag_validate_file, 'file for BDD variable parameters', example_bdd_probs, bdd).
|
||||
:- problog_define_flag(bdd_result, problog_flag_validate_file, 'file to store result calculated from BDD', example_bdd_res, bdd).
|
||||
:- problog_define_flag(bdd_file, problog_flag_validate_file, 'file for BDD script', example_bdd, bdd, flags:bdd_file_handler).
|
||||
:- problog_define_flag(static_order_file, problog_flag_validate_file, 'file for BDD static order', example_bdd_order, bdd).
|
||||
|
||||
%%%%%%%%%%%%
|
||||
% montecarlo: recalculate current approximation after N samples
|
||||
% montecarlo: write log to this file
|
||||
%%%%%%%%%%%%
|
||||
|
||||
:- problog_define_flag(mc_logfile, problog_flag_validate_file, 'logfile for montecarlo', 'log.txt', mcmc).
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% internal control flags
|
||||
|
@ -289,6 +289,14 @@ id_stepsize_handler(stored, Value):-
|
||||
|
||||
bdd_file_handler(message, '').
|
||||
bdd_file_handler(validating, _Value).
|
||||
bdd_file_handler(validate, Value):-
|
||||
convert_filename_to_working_path(Value, Path),
|
||||
catch(file_exists(Path), _, fail), file_property(Path, type(regular)), !.
|
||||
bdd_file_handler(validate, Value):-
|
||||
convert_filename_to_working_path(Value, Path),
|
||||
catch((not(file_exists(Path)), tell(Path)), _, fail),
|
||||
told,
|
||||
delete_file(Path).
|
||||
bdd_file_handler(validated, _Value).
|
||||
bdd_file_handler(stored, Value):-
|
||||
atomic_concat(Value, '_probs', ParValue),
|
||||
@ -296,6 +304,19 @@ bdd_file_handler(stored, Value):-
|
||||
atomic_concat(Value, '_res', ResValue),
|
||||
flag_set(bdd_result, ResValue).
|
||||
|
||||
working_file_handler(message, '').
|
||||
working_file_handler(validating, _Value).
|
||||
working_file_handler(validate, Value):-
|
||||
convert_filename_to_working_path(Value, Path),
|
||||
catch(file_exists(Path), _, fail), file_property(Path, type(regular)), !.
|
||||
working_file_handler(validate, Value):-
|
||||
convert_filename_to_working_path(Value, Path),
|
||||
catch((not(file_exists(Path)), tell(Path)), _, fail),
|
||||
told,
|
||||
delete_file(Path).
|
||||
working_file_handler(validated, _Value).
|
||||
working_file_handler(stored, _Value).
|
||||
|
||||
auto_handler(message, 'auto non-zero').
|
||||
auto_handler(validating, Value) :-
|
||||
number(Value),
|
||||
|
@ -219,7 +219,7 @@
|
||||
:- ensure_loaded(library(system)).
|
||||
|
||||
% load our own modules
|
||||
:- ensure_loaded(flags).
|
||||
:- use_module(gflags, _, [flag_get/2]).
|
||||
|
||||
:- dynamic [problog_path/1, problog_working_path/1].
|
||||
|
||||
@ -228,7 +228,7 @@ set_problog_path(Path):-
|
||||
assert(problog_path(Path)).
|
||||
|
||||
convert_filename_to_working_path(File_Name, Path):-
|
||||
problog_flag(dir, Dir),
|
||||
flag_get(dir, Dir),
|
||||
concat_path_with_filename(Dir, File_Name, Path).
|
||||
|
||||
convert_filename_to_problog_path(File_Name, Path):-
|
||||
|
Reference in New Issue
Block a user