From a83727d2e9006d5a1056d1efc18845d0a84a4659 Mon Sep 17 00:00:00 2001
From: "Nazim@misirlou" <nazim@internet.gestell>
Date: Fri, 6 Dec 2024 12:05:24 +0100
Subject: [PATCH] nzm

---
 n-vivace-satreach-cyber/b-satkubernetes.py | 10 ++-------
 n-vivace-satreach-cyber/c-ECApaths.py      | 24 ++++++++++++++++++----
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/n-vivace-satreach-cyber/b-satkubernetes.py b/n-vivace-satreach-cyber/b-satkubernetes.py
index 328eb63..540bab7 100644
--- a/n-vivace-satreach-cyber/b-satkubernetes.py
+++ b/n-vivace-satreach-cyber/b-satkubernetes.py
@@ -4,15 +4,10 @@ RADIUS=1
 CONTROLSHIFT=1 # shift for reading the initial and final configurations
 NTRANS=8
 
-
-
-# GLOABAL VARS
+# GLOBAL VARS
 T=0 # number of time steps 
 TABTRANS="" # transition table
 
-#sx="*1111101*" # initial configuration
-#sy="*0111001*" # final configuration
-
 
 
 ############### gen cond ##################
@@ -24,8 +19,7 @@ def setConfigCondition(cond, time):
         if cond[i]=='*': # hack to make the variable appear
             print( naming.signedName('0', time, i) + " " + naming.signedName('1', time, i))
         if cond[i] == '0' or cond[i] == '1':
-            biti=cond[i]
-            print ( naming.signedName(biti, time, i) )
+            print ( naming.signedName(cond[i], time, i) )
 
 
 
diff --git a/n-vivace-satreach-cyber/c-ECApaths.py b/n-vivace-satreach-cyber/c-ECApaths.py
index d01e5f5..7cc7683 100644
--- a/n-vivace-satreach-cyber/c-ECApaths.py
+++ b/n-vivace-satreach-cyber/c-ECApaths.py
@@ -1,4 +1,6 @@
 import os, sys
+import subprocess
+import re
 
 ECA=110
 TSTEPS=70
@@ -21,8 +23,22 @@ def run():
     ncells=len(x)+2
     cmd4="python3 w-prnCNFsolution.py %d Zsol-%s.cnf"%(ncells, basename)
     cmdseq=[cmd1,cmd2,cmd3,cmd4]
-    for cmd in cmdseq:
-        #print(cmd)
-        runcmd(cmd)
+    subprocess.run(cmd1.split())
+    subprocess.run(cmd2.split())
+    #------------------------------
+    result = subprocess.getoutput(cmd3)
+    #------------------------------
+    subprocess.run(cmd4.split())
+    
+    itimeCPU=result.index("CPU time")
+    part= result[itimeCPU+20:itimeCPU+35].strip()
+    #print("part:[%s]"%part)
+    tim=re.search("\d[.]?\d+", part)
+    if tim:
+        print("satsolver CPU time:%s"%tim.group(0))
+    else:
+        print("time could not be extracted")
+    
+
+run()
 
-run()
\ No newline at end of file
-- 
GitLab