Skip to content

Commit

Permalink
Made some code a lot cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
anhnamtran committed Jul 19, 2018
1 parent 240df72 commit c7ca050
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions cozy/cost_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,7 @@ def _maintenance_cost(e : Exp, solver : ModelCachingSolver, op : Op, freebies :

def maintenance_cost(e : Exp, solver : ModelCachingSolver, op : Op, freebies : [Exp] = []):
"""This method calulates the result over all expressions that are EStateVar """
res = ZERO
for x in all_exps(e):
if isinstance(x, EStateVar):
res = ESum([
res,
_maintenance_cost(e=x.e, solver=solver, op=op, freebies=freebies)])
return res
return ESum([_maintenance_cost(e=x.e, solver=solver, op=op, freebies=freebies) for x in all_exps(e) if isinstance(x, EStateVar)])


# These require walking over the entire collection.
Expand Down

0 comments on commit c7ca050

Please sign in to comment.