Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lifeware
biocham
Commits
30812478
Commit
30812478
authored
Jan 14, 2020
by
HEMERY Mathieu
Browse files
Rename to lazy_negatives and implement compile_from_pivp\2
parent
56dab4e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
gpac.pl
View file @
30812478
...
...
@@ -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_negati
on
:
yes
)).
:-
initial
(
option
(
lazy_negati
ves
:
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_negati
on
,
lazy_negati
ves
,
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_negati
on
:
yes
)).
:-
biocham
(
option
(
lazy_negati
ves
:
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_negati
on
:yes)).
%:- biocham(option(lazy_negati
ves
: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_negati
on
,
Lazyness
),
get_option
(
lazy_negati
ves
,
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_negati
on
,
Lazyness
),
get_option
(
lazy_negati
ves
,
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_negati
on
,
Lazyness
),
get_option
(
lazy_negati
ves
,
Lazyness
),
Nxt
is
Nc
+
1
,
(
Nxt
=
1
...
...
gpac.plt
View file @
30812478
...
...
@@ -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]],
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment