# Directory names #global basedir,example basedir = "/home/dgc14/Dropbox/HiPEDS/Research/MRes Project/Examples/" examplename = "ReqGrant_Dalal" unrolling_degree = 1 counterstrategy = 0 alternativepath = 0 import re # Util function to build the required counterstrategy's data directory. # A counterstrategy has id x_y_z if the latest Weakness has the same id. # Refinement x_y_z is the z-th alternative Weakness after x_y. x_y is # the y-th Weakness after x. # The corresponding subfolder of counterstrategy0 is counterstrategyx/counterstrategyx_y/counterstrategyx_y_z def getCounterstrategyDirectory(cs_id=counterstrategy): dirname = basedir+examplename+"/counterstrategy0/" if cs_id != 0: branches = re.findall('\d+',str(cs_id)) for i in range(1,len(branches)+1): dirname = dirname+"counterstrategy"+"_".join(branches[:i])+"/" return dirname # Get the subfolder correponding to a particular unrolling def getUnrollingDirectory(cs_id=counterstrategy,unr=unrolling_degree): return getCounterstrategyDirectory(cs_id)+"unrolling"+str(unr)+"/" # Get alternative path directory def getAlternativePathDirectory(cs_id=counterstrategy,alt_path=alternativepath): dirname = getCounterstrategyDirectory(cs_id) if alt_path != 0: return dirname + "alternativepath" + str(alt_path) + "/" else: return dirname