Skip to content
Snippets Groups Projects
Commit 508a9cc1 authored by René Schöne's avatar René Schöne
Browse files

always calculate stats.

parent d26d4b6c
No related branches found
No related tags found
No related merge requests found
...@@ -115,7 +115,8 @@ def prepare_dstat(f): ...@@ -115,7 +115,8 @@ def prepare_dstat(f):
@task(name = 'sol') @task(name = 'sol')
def sol(number = 1, solver = 'glpsol', pathname = '*', skip_conflate = False, timeout = 40): def sol(number = 1, solver = 'glpsol', pathname = '*', skip_conflate = False, timeout = 40):
""" Run solver n times (default: once) """ """ Run solver n times (default: once)
Possible solvers: glpsol (default), gurobi """
do_sol(solver, int(number), pathname, skip_conflate, int(timeout)) do_sol(solver, int(number), pathname, skip_conflate, int(timeout))
params = { 'glpsol' : ['glpsol --tmlim {timeout} --lp {lp} -w {sol}', 'INTEGER OPTIMAL SOLUTION FOUND', 'Time used:[\s]*(.*?) secs', '(\d+) rows, (\d+) columns, (\d+) non-zeros'], params = { 'glpsol' : ['glpsol --tmlim {timeout} --lp {lp} -w {sol}', 'INTEGER OPTIMAL SOLUTION FOUND', 'Time used:[\s]*(.*?) secs', '(\d+) rows, (\d+) columns, (\d+) non-zeros'],
...@@ -130,6 +131,9 @@ def do_sol(solver, number, pathname, skip_conflate, timeout): ...@@ -130,6 +131,9 @@ def do_sol(solver, number, pathname, skip_conflate, timeout):
if not os.path.isdir(d): if not os.path.isdir(d):
print red("Not a valid directory: {0}".format(d)) print red("Not a valid directory: {0}".format(d))
continue continue
if '-noncached-' in d or '-flushed-' in d:
# skip this, as ILP would be the same
continue
sys.stdout.write(d) sys.stdout.write(d)
os.chdir(d) os.chdir(d)
files = glob('*.lp') files = glob('*.lp')
...@@ -156,12 +160,14 @@ def do_sol(solver, number, pathname, skip_conflate, timeout): ...@@ -156,12 +160,14 @@ def do_sol(solver, number, pathname, skip_conflate, timeout):
today = datetime.today() today = datetime.today()
if re.search(params[solver][1], out): if re.search(params[solver][1], out):
duration = re.search(params[solver][2], out).group(1) duration = re.search(params[solver][2], out).group(1)
# stats=row,col,nonzero
stats = re.search(params[solver][3], out).groups()
sys.stdout.write('.') sys.stdout.write('.')
else: else:
sys.stdout.write(red('!'))
duration = -1 duration = -1
sys.stdout.write(red('!'))
# stats=row,col,nonzero
stats = re.search(params[solver][3], out).groups()
if len(stats) == 0:
stats = [-1,-1,-1]
sys.stdout.flush() sys.stdout.flush()
row = list((today.isoformat(),dirname(d), ilp.rsplit('.', 1)[0]) + row = list((today.isoformat(),dirname(d), ilp.rsplit('.', 1)[0]) +
stats + (duration, stop-start)) stats + (duration, stop-start))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment