Skip to content

Commit

Permalink
added if-clause in postprocess to prevent attribute error in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Brendel committed Nov 24, 2021
1 parent 6b3b7be commit b783119
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions paper.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ def main_naive(configs, time_limit, out_dir, time_windows):
elif grb_mod.status == 9:
status = 'TIMEOUT'
logger.info(f'Timeout after {grb_mod.runtime} s')
if hasattr(grb_mod, 'objVal'):
logger.info(f'Objective: {grb_mod.objVal}')

res_frame = res_frame.append({'config': config_name,
't': t,
Expand Down
5 changes: 3 additions & 2 deletions smart_krit.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,9 @@ def postprocess(self, mod):
varlist = mod.getVars()
with open(filepath, 'w') as out_file:
for v in varlist:
out_file.write( '%s %g' % (v.varName, v.x) )
out_file.write('\n')
if hasattr(v, 'x'):
out_file.write( '%s %g' % (v.varName, v.x) )
out_file.write('\n')

model_dict = {'times': self.times,
't_0': self.t_0,
Expand Down

0 comments on commit b783119

Please sign in to comment.