Skip to content

Commit

Permalink
update to new pyasp version 1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sthiele committed Mar 29, 2017
1 parent 144705e commit 85d55a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

setup(
name = 'iggy',
version = '1.3',
version = '1.4',
url = 'http://bioasp.github.io/iggy/',
license = 'GPLv3+',
description = 'A tool for consistency based analysis of influence graphs and observed systems behavior.',
Expand All @@ -31,5 +31,5 @@
package_dir = {'__iggy__' : 'src'},
package_data = {'__iggy__' : ['encodings/*.lp','encodings/*.gringo']},
scripts = ['iggy.py', 'opt_graph.py'],
install_requires = ['pyasp == 1.4.2']
install_requires = ['pyasp == 1.4.3']
)
30 changes: 15 additions & 15 deletions src/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,11 @@ def get_opt_add_remove_edges_greedy(instance):

while fedges:
sys.stdout.flush()
print ("TODO: ",len(fedges))
# print ("TODO: ",len(fedges))
(oedges, oscenfit, orepscore) = fedges.pop()

print('(oedges,oscenfit, orepscore):',(oedges,oscenfit, orepscore))
print('len(oedges):',len(oedges))
# print('(oedges,oscenfit, orepscore):',(oedges,oscenfit, orepscore))
# print('len(oedges):',len(oedges))

# extend till no better solution can be found
end = True # assume this time its the end
Expand All @@ -367,40 +367,40 @@ def get_opt_add_remove_edges_greedy(instance):
nscenfit = models[0].score[0]
nrepscore = models[0].score[1]+2*(len(oedges))

print('nscenfit: ',nscenfit)
print('nrepscore: ',nrepscore)
# print('nscenfit: ',nscenfit)
# print('nrepscore: ',nrepscore)

if (nscenfit < oscenfit) or nrepscore < orepscore: # better score or more that 1 scenfit
print('maybe better solution:')
print('#models: ',len(models))
# print('maybe better solution:')
# print('#models: ',len(models))

for m in models:
#print('MMM ',models)
nend = TermSet()
for a in m :
if a.pred() == 'rep' :
if a.arg(0)[0:7]=='addeddy' :
print('new addeddy to',a.arg(0)[8:-1])
# print('new addeddy to',a.arg(0)[8:-1])
nend = String2TermSet('edge_end('+(a.arg(0)[8:-1])+')')

# search starts of the addeddy
print('search best edge starts')
# print('search best edge starts')
f_end = TermSet(nend).to_file()

prg = [ inst, f_oedges, remove_edges_prg, f_end, best_edge_start_prg,
min_repairs_prg, show_rep_prg
] + sem + scenfit
starts = solver.run(prg, collapseTerms=True, collapseAtoms=False)
os.unlink(f_end)
print(starts)
# print(starts)
for s in starts:
n2scenfit = s.score[0]
n2repscore = s.score[1]+2*(len(oedges))
print('n2scenfit: ', n2scenfit)
print('n2repscore: ', n2repscore)
# print('n2scenfit: ', n2scenfit)
# print('n2repscore: ', n2repscore)

if (n2scenfit < oscenfit) or n2repscore < orepscore: # better score or more that 1 scenfit
print('better solution:')
# print('better solution:')
if (n2scenfit<bscenfit):
bscenfit = n2scenfit # update bscenfit
brepscore = n2repscore
Expand All @@ -411,7 +411,7 @@ def get_opt_add_remove_edges_greedy(instance):
for a in s :
if a.pred() == 'rep' :
if a.arg(0)[0:7]=='addedge' :
print('new edge ',a.arg(0)[8:-1])
# print('new edge ',a.arg(0)[8:-1])
nedge = String2TermSet('obs_elabel('+(a.arg(0)[8:-1])+')')
end = False

Expand All @@ -422,7 +422,7 @@ def get_opt_add_remove_edges_greedy(instance):

if end :
if (oedges,oscenfit,orepscore) not in tedges and oscenfit == bscenfit and orepscore == brepscore:
print('LAST tedges append',oedges)
# print('LAST tedges append',oedges)
tedges.append((oedges,oscenfit,orepscore))

# end while
Expand Down

0 comments on commit 85d55a3

Please sign in to comment.