Commit 3794c8f8 authored by Prasanna's avatar Prasanna
Browse files

minor edits to the benchmarks

parent 13a6150d
...@@ -25,12 +25,12 @@ def readResults(fname, evalnum): ...@@ -25,12 +25,12 @@ def readResults(fname, evalnum):
with open(fname, 'rt') as in_file: with open(fname, 'rt') as in_file:
for linenum, line in enumerate(in_file): for linenum, line in enumerate(in_file):
if pattern1.search(line) is not None: if pattern1.search(line) is not None:
print(line) #print(line)
str1 = line.rstrip('\n') str1 = line.rstrip('\n')
res = re.findall('START TIME:(.*)', str1) res = re.findall('START TIME:(.*)', str1)
resDict['startTime'] = int(res[0]) resDict['startTime'] = int(res[0])
elif pattern2.search(line) is not None: elif pattern2.search(line) is not None:
print(line) #print(line)
str1 = line.rstrip('\n') str1 = line.rstrip('\n')
res = re.findall('OUTPUT:(.*)', str1) res = re.findall('OUTPUT:(.*)', str1)
rv = float(res[0]) rv = float(res[0])
...@@ -38,12 +38,12 @@ def readResults(fname, evalnum): ...@@ -38,12 +38,12 @@ def readResults(fname, evalnum):
rv = sys.float_info.max rv = sys.float_info.max
resDict['cost'] = rv resDict['cost'] = rv
elif pattern3.search(line) is not None: elif pattern3.search(line) is not None:
print(line) #print(line)
str1 = line.rstrip('\n') str1 = line.rstrip('\n')
res = re.findall('END TIME:(.*)', str1) res = re.findall('END TIME:(.*)', str1)
resDict['endTime'] = int(res[0]) resDict['endTime'] = int(res[0])
elif pattern4.search(line) is not None: elif pattern4.search(line) is not None:
print(line) #print(line)
str1 = line.rstrip('\n') str1 = line.rstrip('\n')
res = re.findall('INPUT:(.*)', str1) res = re.findall('INPUT:(.*)', str1)
resDict['x'] = eval(res[0]) resDict['x'] = eval(res[0])
...@@ -56,7 +56,7 @@ def readResults(fname, evalnum): ...@@ -56,7 +56,7 @@ def readResults(fname, evalnum):
time.sleep(5) time.sleep(5)
except Exception: except Exception:
print('Unexpected error:', sys.exc_info()[0]) print('Unexpected error:', sys.exc_info()[0])
print(resDict) #print(resDict)
return(resDict) return(resDict)
def commandLine(x, params): def commandLine(x, params):
...@@ -64,7 +64,7 @@ def commandLine(x, params): ...@@ -64,7 +64,7 @@ def commandLine(x, params):
hlist = [] hlist = []
for p, v in zip(params, x): for p, v in zip(params, x):
cmd = cmd + ('--%s %s ') % (p, str(v)) cmd = cmd + ('--%s %s ') % (p, str(v))
print(cmd) #print(cmd)
return(cmd) return(cmd)
def evaluate(x, evalCounter, params, prob_dir, job_dir, result_dir): def evaluate(x, evalCounter, params, prob_dir, job_dir, result_dir):
...@@ -81,7 +81,7 @@ def evaluate(x, evalCounter, params, prob_dir, job_dir, result_dir): ...@@ -81,7 +81,7 @@ def evaluate(x, evalCounter, params, prob_dir, job_dir, result_dir):
status = subprocess.check_output('chmod +x %s' % jobfile, shell=True) status = subprocess.check_output('chmod +x %s' % jobfile, shell=True)
status = subprocess.call(' sh %s ' % jobfile, shell=True) status = subprocess.call(' sh %s ' % jobfile, shell=True)
resDict = readResults(outputfile, evalCounter) resDict = readResults(outputfile, evalCounter)
print(resDict) #print(resDict)
return(resDict) return(resDict)
...@@ -9,7 +9,7 @@ class Problem(): ...@@ -9,7 +9,7 @@ class Problem():
space['p4'] = ['a', 'b', 'c'] space['p4'] = ['a', 'b', 'c']
self.space = space self.space = space
self.params = self.space.keys() self.params = self.space.keys()
self.starting_point = [2, 8, 2, 'c'] self.starting_point = [10, 1000, 64, 'c']
if __name__ == '__main__': if __name__ == '__main__':
instance = Problem() instance = Problem()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment