Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 30812478 authored by HEMERY Mathieu's avatar HEMERY Mathieu
Browse files

Rename to lazy_negatives and implement compile_from_pivp\2

parent 56dab4e7
......@@ -62,7 +62,7 @@ Rq: The distinction between pivp_string and pivp_list is not always obvious.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- initial(option(binomial_reduction: no)).
:- initial(option(lazy_negation: yes)).
:- initial(option(lazy_negatives: yes)).
%! compile_from_expression(+Expr, +Input, +Output)
%
......@@ -91,7 +91,7 @@ compile_from_expression(Expr, Input, Output) :-
'Determine if the binomial reduction has to be performed'
),
option(
lazy_negation,
lazy_negatives,
yesno,
_Lazyness,
'Switch between a brutal or a lazy negation'
......@@ -141,7 +141,7 @@ compile_from_expression(Expr, Input, Output) :-
:- doc('
\\begin{example} Compilation of a simple oscillator with 2 species\n
').
:- biocham(option(lazy_negation:yes)).
:- biocham(option(lazy_negatives:yes)).
:- biocham(compile_from_pivp((0.5,(d(x)/dt= x - x*y));(0.25,(d(y)/dt= x*y - 0.5*y)),time,output)).
:- biocham(list_model).
:- biocham(numerical_simulation(time:10)). % method:msbdf
......@@ -153,7 +153,7 @@ compile_from_expression(Expr, Input, Output) :-
%:- doc('
% \\begin{example} Compilation of a Hill function of order 2 as a function of input\n
%').
%:- biocham(option(lazy_negation:yes)).
%:- biocham(option(lazy_negatives:yes)).
%:- biocham(option(binomial_reduction:yes)).
%:- biocham(compile_from_pivp((0.0,(d(h)/dt= 2*x*x*y)),(1.0,(d(x)/dt= -2*x*x*y));(0.0,(d(y)/dt= 1)),input,hill)).
%:- biocham(list_model).
......@@ -266,7 +266,25 @@ compile_from_pivp(PIVP, Output) :-
_Reduction,
'Determine if the binomial reduction has to be performed'
),
compile_from_pivp(PIVP, time, Output).
sort_output(PIVP, Output, PIVP_sorted),
compile_from_pivp(PIVP_sorted, time, Output).
%! sort_output(+PIVP, +Output, -PIVP_sorted)
%
% Ensure that Output is the first variable of the PIVP
sort_output((IC, d(Out)/dt = Deriv), Out, (IC, d(Out)/dt = Deriv)) :- !.
sort_output((IC, d(Out)/dt = Deriv);Remainder, Out, (IC, d(Out)/dt = Deriv);Remainder) :- !.
sort_output(Remainder;(IC, d(Out)/dt = Deriv), Out, (IC, d(Out)/dt = Deriv);Remainder) :- !.
sort_output(R1;(IC, d(Out)/dt = Deriv);R2, Out, (IC, d(Out)/dt = Deriv);R1;R2) :- !.
sort_output(_PIVP1, _Out, _PIVP2) :-
print_message(warning, 'Output should be a variable of the PIVP'),
fail.
%! compile_from_pivp(+PIVP_string, +Input , +Output)
......@@ -332,7 +350,7 @@ compile_from_pivp(PIVP, Input, Output) :-
main_compiler(PIVP_input, Input, Output):-
clear_model,
get_option(fast_rate, Fast),
get_option(lazy_negation, Lazyness),
get_option(lazy_negatives, Lazyness),
get_option(binomial_reduction, Reduction),
(
Input = time
......@@ -349,7 +367,7 @@ main_compiler(PIVP_input, Input, Output):-
PIVP_unsigned = PIVP_non_bin
),
PIVP_unsigned = [N,_PODE,_IV],
get_option(lazy_negation, Lazyness),
get_option(lazy_negatives, Lazyness),
(
Lazyness = yes
->
......@@ -1527,7 +1545,7 @@ affect_name(N,Output,Input,Varneg,Name_list) :-
affect_name(N,N,_Output,_Input,_Varneg,[]) :- !.
affect_name(N,Nc,Output,Input,Varneg,Name_list) :-
get_option(lazy_negation, Lazyness),
get_option(lazy_negatives, Lazyness),
Nxt is Nc+1,
(
Nxt = 1
......
......@@ -20,6 +20,11 @@ test(format_pivp_higher_order) :-
once(gpac:format_pivp(((1,(d(y)/dt=y*z+3*z)); (5,(d(z)/dt= (-1*y^3)))),
[2,[[[1,[1, 1]],[3,[0, 1]]],[[-1,[3, 0]]]],[1,5]] )).
%
test(sort_output) :-
gpac:sort_output((1,d(cos)/dt=(-1*sin);0,d(sin)/dt=cos),cos,(1,d(cos)/dt=(-1*sin);0,d(sin)/dt=cos)),
gpac:sort_output((0,d(sin)/dt=cos;1,d(cos)/dt=(-1*sin)),cos,(1,d(cos)/dt=(-1*sin);0,d(sin)/dt=cos)).
%%% Test of g_to_c %%%
test(g_to_c_PIVP) :-
Old_PIVP = [1, [[[-1,[1]]]], [1]],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment