Fix order in some predicates to make search tree (considerably) smaller
authorDaniel Schwyn <danielschwyn@gmail.com>
Thu, 18 May 2017 22:12:21 +0000 (00:12 +0200)
committerDaniel Schwyn <schwyda@student.ethz.ch>
Tue, 13 Jun 2017 12:21:24 +0000 (14:21 +0200)
Signed-off-by: Daniel Schwyn <schwyda@student.ethz.ch>

tools/sockeye2/decodingNet.pl

index 34e6900..baae557 100644 (file)
@@ -38,10 +38,10 @@ translate(Node,Addr,Name) :-
     node(_,_,Overlay) = Node,
     Name = name(Overlay,Addr).
 
-accepted(Name) :-
+acceptedName(Name) :-
+    name(NodeId,Addr) = Name,
     net(NodeId,Node),
-    accept(Node,Addr),
-    Name = name(NodeId,Addr).
+    accept(Node,Addr).
 
 decodeStep(name(NodeId,Addr),Name) :-
     net(NodeId,Node),
@@ -54,7 +54,7 @@ decodesTo(SrcName,DestName) :-
     ).
 
 resolve(SrcName,DestName) :-
-    accepted(DestName),
     (   DestName = SrcName
     ;   decodesTo(SrcName,DestName)
-    ).
+    ),
+    acceptedName(DestName).