Commit aea7cf84 authored by Mathieu Hemery's avatar Mathieu Hemery

Bugs hunting and killing, but some are still alive

parent d8798458
......@@ -36,6 +36,13 @@ is_null(Zero) :-
fail
).
is_one(One) :-
catch(
One =:= 1,
error(_A,_B),
fail
).
simplify_aux(In, Out) :-
additive_block(In, Blocks),
!,
......@@ -45,6 +52,8 @@ simplify_aux(In, Out) :-
simplify_aux(Zero*_Other, 0) :- is_null(Zero), !.
simplify_aux(_Other*Zero, 0) :- is_null(Zero), !.
simplify_aux(One*Other, Other) :- is_one(One), !.
simplify_aux(Other*One, Other) :- is_one(One), !.
simplify_aux(In, Out) :-
multiplicative_block(In, Blocks),
......
......@@ -1505,16 +1505,16 @@ set_initial_vector([X|T], D) :-
name_p_m('z', D, Z_p, Z_m)
),
(
X > 0
catch(X > 0, error(_A,_B), fail)
->
present([Z_p], X)
;
X < 0
catch(X < 0, error(_A,_B), fail)
->
Y is -X,
present([Z_m], Y)
;
true
present([Z_p], X)
),
Dp is D + 1,
set_initial_vector(T, Dp).
......
......@@ -141,20 +141,32 @@ rewrite_initial_concentration(Init, VarNeg, Init_New) :-
rewrite_initial_concentration([], _VarNeg, [], _N).
rewrite_initial_concentration([Conc|Tail], VarNeg, Init_New, N) :-
rewrite_initial_concentration([RawConc|Tail], VarNeg, Init_New, N) :-
(
member(N,VarNeg)
->
(
Conc > 0
parameter_value(input,Input_Value)
->
append([Conc,0], Init_New_Tail, Init_New)
substitute([input], [Input_Value], RawConc, Conc)
;
ConcN is -Conc,
append([0,ConcN], Init_New_Tail, Init_New)
Conc = RawConc
),
(
Conc >= 0
->
append([RawConc,0], Init_New_Tail, Init_New)
;
(
catch(ConcN is -RawConc, error(_A,_B), fail)
->
append([0,ConcN], Init_New_Tail, Init_New)
;
append([0,-RawConc], Init_New_Tail, Init_New)
)
)
;
append([Conc], Init_New_Tail, Init_New)
append([RawConc], Init_New_Tail, Init_New)
),
Np is N+1,
rewrite_initial_concentration(Tail, VarNeg, Init_New_Tail, Np).
......
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