-
Notifications
You must be signed in to change notification settings - Fork 1
/
solveLP.lp4
34 lines (24 loc) · 1.26 KB
/
solveLP.lp4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% solve[LP].lp4
% Logic Program in Clingo[LP] - Clingcon ASP format
% Finds fluxes that belongs to the stoichiometric matrix kernel
% Defines an heuristic for them to be enumerated subset minimal
% Domain upper bound for flux values
#const nb=500000.
% Tells clingo that it is okay if the input file does not contain these predicates
reversible(do_not_use, do_not_use).
% Rule A: Since all reactions are irreversible, they must have a nonnegative flux
&dom{0..nb} = flux(R) :- reaction(R).
% Rule B: Two irreversible reactions issued from the splitting of one reversible reaction are mutually exclusive
:- support(R1); support(R2); 1 {reversible(R1, R2); reversible(R2, R1)} 1; reaction(R1); reaction(R2).
% Note : {a;b} is chosen because relation reversible(X,Y) is symetric
% This is a precaution in case the relation was only defined one-way
% Rule C : At least one reaction must be used
:- not support(R) : reaction(R).
% Rule D : For each metabolite, the sum, weighted by the stoichiometry, of fluxes of all reactions is null
&sum{C*flux(R) : stoichiometry(M, R, C), reaction(R)} = 0 :- metabolite(M).
% Compute support
support(R) :- &sum{flux(R)} > 0; reaction(R).
% Support minimization heuristic
#heuristic support(R). [1, false]
% Only show support atoms
#show support/1.