@@ -2,23 +2,25 @@ sign(0;1).
2
2
complement (T ,S ) :- sign (S ),sign (T ),T != S .
3
3
% Make unreached vertices inputs
4
4
input (P ,V ) :- exp (P ), vertex (V ), not function (_,V ),not edge (U ,V ) : edge (U ,V ), U != V .
5
-
5
+ isRepair (U ):- vertex (U ), not repairable (_), not isTemp (U ).
6
+ isRepair (U ):- repairable (U ), not isTemp (U ).
6
7
timeStep (TI ):- obs_vlabel (_,_,_,TI ).
7
8
1 {vlabel (P ,V ,1 ,TI );vlabel (P ,V ,0 ,TI )}1 :- vertex (V ),exp (P ),timeStep (TI ).
8
9
:- vlabel (P ,V ,S ,TI ), obs_vlabel (P ,V ,T ,TI ),complement (S ,T ).
9
- :- vlabel (P ,O ,0 ,TI ),functionAnd (N ,O ), noneNegative (O ,N ,P ,TI ), vertex (O ), exp (P ), not repair (functionOr (N ,O )).
10
- :- vlabel (P ,O ,1 ,TI ),functionAnd (N ,O ), oneNegative (O ,N ,P ,TI ), vertex (O ), exp (P ),timeStep (TI ), not repair (functionOr (N ,O )).
11
- :- vlabel (P ,O ,0 ,TI ),repair (functionAnd (N ,O )), noneNegative (O ,N ,P ,TI ), vertex (O ), exp (P ), not repair (functionOr (N ,O )).
12
- :- vlabel (P ,O ,1 ,TI ),repair (functionAnd (N ,O )), oneNegative (O ,N ,P ,TI ), vertex (O ), exp (P ),timeStep (TI ), not repair (functionOr (N ,O )).
13
- :- vlabel (P ,O ,1 ,TI ),functionOr (N ,O ), nonePositive (O ,N ,P ,TI ), vertex (O ), exp (P ), not repair (functionAnd (N ,O )).
14
- :- vlabel (P ,O ,0 ,TI ),functionOr (N ,O ), onePositive (O ,N ,P ,TI ), vertex (O ), exp (P ),timeStep (TI ), not repair (functionAnd (N ,O )).
15
- :- vlabel (P ,O ,1 ,TI ),repair (functionOr (N ,O )), nonePositive (O ,N ,P ,TI ), vertex (O ), exp (P ), not repair (functionAnd (N ,O )).
16
- :- vlabel (P ,O ,0 ,TI ),repair (functionOr (N ,O )), onePositive (O ,N ,P ,TI ), vertex (O ), exp (P ),timeStep (TI ), not repair (functionAnd (N ,O )).
17
- :- vlabel (P ,O ,T ,TI ),functionId (N ,O ), not repaired (N ,O ), regulatorSign (P ,N ,O ,S ,TI ), vertex (O ), exp (P ),complement (S ,T ),not removeRegulator (N ,O ).
18
- :- vlabel (P ,O ,T ,TI ),repair_functionNot (N ,O ), regulatorSign (P ,N ,O ,S ,TI ), vertex (O ), exp (P ),complement (S ,T ),not removeRegulator (N ,O ).
10
+ a ( O ) :- vlabel (P ,O ,0 ,TI ),functionAnd (N ,O ), noneNegative (O ,N ,P ,TI ), vertex (O ), exp (P ), not repair (functionOr (N ,O )).
11
+ a ( O ) :- vlabel (P ,O ,1 ,TI ),functionAnd (N ,O ), oneNegative (O ,N ,P ,TI ), vertex (O ), exp (P ),timeStep (TI ), not repair (functionOr (N ,O )).
12
+ a ( O ) :- vlabel (P ,O ,0 ,TI ),repair (functionAnd (N ,O )), noneNegative (O ,N ,P ,TI ), vertex (O ), exp (P ), not repair (functionOr (N ,O )).
13
+ a ( O ) :- vlabel (P ,O ,1 ,TI ),repair (functionAnd (N ,O )), oneNegative (O ,N ,P ,TI ), vertex (O ), exp (P ),timeStep (TI ), not repair (functionOr (N ,O )).
14
+ a ( O ) :- vlabel (P ,O ,1 ,TI ),functionOr (N ,O ), nonePositive (O ,N ,P ,TI ), vertex (O ), exp (P ), not repair (functionAnd (N ,O )).
15
+ a ( O ) :- vlabel (P ,O ,0 ,TI ),functionOr (N ,O ), onePositive (O ,N ,P ,TI ), vertex (O ), exp (P ),timeStep (TI ), not repair (functionAnd (N ,O )).
16
+ a ( O ) :- vlabel (P ,O ,1 ,TI ),repair (functionOr (N ,O )), nonePositive (O ,N ,P ,TI ), vertex (O ), exp (P ), not repair (functionAnd (N ,O )).
17
+ a ( O ) :- vlabel (P ,O ,0 ,TI ),repair (functionOr (N ,O )), onePositive (O ,N ,P ,TI ), vertex (O ), exp (P ),timeStep (TI ), not repair (functionAnd (N ,O )).
18
+ a ( O ) :- vlabel (P ,O ,T ,TI ),functionId (N ,O ), not repaired (N ,O ), regulatorSign (P ,N ,O ,S ,TI ), vertex (O ), exp (P ),complement (S ,T ),not removeRegulator (N ,O ).
19
+ a ( O ) :- vlabel (P ,O ,T ,TI ),repair_functionNot (N ,O ), regulatorSign (P ,N ,O ,S ,TI ), vertex (O ), exp (P ),complement (S ,T ),not removeRegulator (N ,O ).
19
20
:- vertex (V ), exp (P ), timeStep (T ),not vlabel (P ,V ,_,T ).
20
- :- vlabel (P ,O ,S ,TI ),functionNot (N ,O ), regulatorSign (P ,N ,O ,S ,TI ), not repair_functionNot (N ,O ),not removeRegulator (N ,O ).
21
-
21
+ a (O ):- vlabel (P ,O ,S ,TI ),functionNot (N ,O ), regulatorSign (P ,N ,O ,S ,TI ), not repair_functionNot (N ,O ),not removeRegulator (N ,O ).
22
+ b (O ):- a (O ),not isTemp (O ).
23
+ #show b /1 .
22
24
%Regulators, check if edge is removed
23
25
isRegulator (N ,V ) :- regulator (N ,V ), not removeRegulator (N ,V ), not negReapir (N ,V ).
24
26
negReapir (N ,V ):- repaired (N ,V ), not functionNot (N ,_).
@@ -47,29 +49,29 @@ function(N,V) :- functionU(N,V).
47
49
functionU (N ,V ):- functionNot (N ,V ).
48
50
functionU (N ,V ):- functionId (N ,V ).
49
51
%Possible repairs
50
- pos (functionOr (N ,O )) :- repair_g , not obs_vlabel (P ,O ,_,TI ),not nonePositive (O ,N ,P ,TI ),not functionOr (N ,O ),functionAnd (N ,O ),exp (P ),plusinfluence (O ),timeStep (TI ).
51
- pos (functionOr (N ,O )) :- repair_g , not obs_vlabel (P ,O ,_,TI ),nonePositive (O ,N ,P ,TI ),not functionOr (N ,O ),functionAnd (N ,O ),plusinfluence (O ).
52
+ pos (functionOr (N ,O )) :- repair_g , not obs_vlabel (P ,O ,_,TI ),not nonePositive (O ,N ,P ,TI ),not functionOr (N ,O ),functionAnd (N ,O ),exp (P ),plusinfluence (O ),timeStep (TI ), isRepair ( O ).
53
+ pos (functionOr (N ,O )) :- repair_g , not obs_vlabel (P ,O ,_,TI ),nonePositive (O ,N ,P ,TI ),not functionOr (N ,O ),functionAnd (N ,O ),plusinfluence (O ), isRepair ( O ).
52
54
53
- pos (functionOr (N ,O )) :- repair_g , obs_vlabel (P ,O ,1 ,TI ),not nonePositive (O ,N ,P ,TI ),not functionOr (N ,O ),functionAnd (N ,O ),exp (P ),plusinfluence (O ).
54
- pos (functionOr (N ,O )) :- repair_g , obs_vlabel (P ,O ,0 ,TI ),nonePositive (O ,N ,P ,TI ),not functionOr (N ,O ),functionAnd (N ,O ),plusinfluence (O ).
55
+ pos (functionOr (N ,O )) :- repair_g , obs_vlabel (P ,O ,1 ,TI ),not nonePositive (O ,N ,P ,TI ),not functionOr (N ,O ),functionAnd (N ,O ),exp (P ),plusinfluence (O ), isRepair ( O ).
56
+ pos (functionOr (N ,O )) :- repair_g , obs_vlabel (P ,O ,0 ,TI ),nonePositive (O ,N ,P ,TI ),not functionOr (N ,O ),functionAnd (N ,O ),plusinfluence (O ), isRepair ( O ).
55
57
56
- pos (functionAnd (N ,O )) :- repair_g , not obs_vlabel (P ,O ,_,TI ),noneNegative (O ,N ,P ,TI ),not functionAnd (N ,O ),functionOr (N ,O ),plusinfluence (O ).
57
- pos (functionAnd (N ,O )) :- repair_g , not obs_vlabel (P ,O ,_,TI ),not noneNegative (O ,N ,P ,TI ),not functionAnd (N ,O ),functionOr (N ,O ),exp (P ),plusinfluence (O ),timeStep ( TI ).
58
+ pos (functionAnd (N ,O )) :- repair_g , not obs_vlabel (P ,O ,_,TI ),noneNegative (O ,N ,P ,TI ),not functionAnd (N ,O ),functionOr (N ,O ),plusinfluence (O ), isRepair ( O ).
59
+ pos (functionAnd (N ,O )) :- timeStep ( TI ), repair_g , not obs_vlabel (P ,O ,_,TI ),not noneNegative (O ,N ,P ,TI ),not functionAnd (N ,O ),functionOr (N ,O ),exp (P ),plusinfluence (O ), isRepair ( O ).
58
60
59
- pos (functionAnd (N ,O )) :- repair_g , obs_vlabel (P ,O ,1 ,TI ),noneNegative (O ,N ,P ,TI ),not functionAnd (N ,O ),functionOr (N ,O ),plusinfluence (O ).
60
- pos (functionAnd (N ,O )) :- repair_g , obs_vlabel (P ,O ,0 ,TI ),not noneNegative (O ,N ,P ,TI ),not functionAnd (N ,O ),functionOr (N ,O ),exp (P ),plusinfluence (O ).
61
+ pos (functionAnd (N ,O )) :- repair_g , obs_vlabel (P ,O ,1 ,TI ),noneNegative (O ,N ,P ,TI ),not functionAnd (N ,O ),functionOr (N ,O ),plusinfluence (O ), isRepair ( O ).
62
+ pos (functionAnd (N ,O )) :- repair_g , obs_vlabel (P ,O ,0 ,TI ),not noneNegative (O ,N ,P ,TI ),not functionAnd (N ,O ),functionOr (N ,O ),exp (P ),plusinfluence (O ), isRepair ( O ).
61
63
62
64
plusinfluence (O ):- edge (V ,O ), edge (W ,O ), W != O ,W != V ,V != O , not repair (rEdge (V ,O )), not repair (rEdge (W ,O )),not removeEdge (V ,O ),not removeEdge (W ,O ).
63
65
64
66
65
- pos (rEdge (U ,V )) :- repair_e , regulator (N ,U ), function (N ,V ), regulator (N ,W ), not removeEdge (W ,V ),not isTemp (V ), not isTemp (U ).
66
- pos (rEdge (U ,D )) :- repair_e , regulator (N ,U ), regulator (N ,W ), function (N ,V ),isTemp (V ),isFunction (V ,D ), not isTemp (D ), not isTemp (U ).
67
+ pos (rEdge (U ,V )) :- repair_e , regulator (N ,U ), function (N ,V ), regulator (N ,W ), not removeEdge (W ,V ),not isTemp (V ), not isTemp (U ), isRepair ( V ) .
68
+ pos (rEdge (U ,D )) :- repair_e , regulator (N ,U ), regulator (N ,W ), function (N ,V ),isTemp (V ),isFunction (V ,D ), not isTemp (D ), not isTemp (U ), isRepair ( D ) .
67
69
removeEdge (U ,W ):- repair (rEdge (U ,D )),regulator (N ,U ), function (N ,W ), isTemp (W ),isFunction (W ,D ), not isTemp (D ).
68
70
removeEdge (U ,D ):- repair (rEdge (U ,D )),regulator (N ,U ), function (N ,D ),regulator (N ,W ), not removeEdge (W ,D ), not isTemp (D ).
69
71
removeEdge (W ,D ):- removeEdge (U ,W ),regulator (N ,U ),functionU (N ,W ),regulator (M ,W ),function (M ,D ),D != U ,W != D ,M != N .
70
72
71
- pos (regulator (O ,V )):- repair_i , regulator (N ,V ), function (N ,O ), not isTemp (O ), not isTemp (V ),not removeRegulator (N ,V ).
72
- pos (regulator (O ,V )):- repair_i , regulator (N ,V ), function (N ,W ), isTemp (W ),isFunction (W ,O ), not isTemp (O ), not isTemp (V ),not removeRegulator (N ,V ).
73
+ pos (regulator (O ,V )):- repair_i , regulator (N ,V ), function (N ,O ), not isTemp (O ), not isTemp (V ),not removeRegulator (N ,V ), isRepair ( O ) .
74
+ pos (regulator (O ,V )):- repair_i , regulator (N ,V ), function (N ,W ), isTemp (W ),isFunction (W ,O ), not isTemp (O ), not isTemp (V ),not removeRegulator (N ,V ), isRepair ( O ) .
73
75
isFunction (W ,O ):- regulator (N ,W ),function (N ,O ), not isTemp (O ).
74
76
isFunction (W ,O ):- regulator (N ,W ),function (N ,V ),isTemp (V ), V != O ,isFunction (V ,O ).
75
77
@@ -87,7 +89,7 @@ edge(V,temporary(regulator(N,V))):- repaired(N,V), not functionNot(N,_).
87
89
repair_functionNot (N ,V ):- functionNot (N ,V ), repaired (N ,W ),regulator (N ,W ).
88
90
89
91
{ repair (R ) : pos (R ) }.
90
- #show repair /1 .
92
+ % #show repair/1.
91
93
vertex (V ):- edge (V ,_).
92
94
vertex (V ):- edge (_,V ).
93
95
isTemp (temporary (V )):- vertex (temporary (V )).
0 commit comments