Skip to content

Commit

Permalink
Removed prints and added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
anhnamtran committed Jul 18, 2018
1 parent ea7f68b commit d4fe6ef
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cozy/cost_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,13 @@ def worst_case_cardinality(e : Exp) -> DominantTerm:
return DominantTerm.N

def _maintenance_cost(e : Exp, solver : ModelCachingSolver, op : Op, freebies : [Exp] = []):
"""Determines the maintenance cost of an expression with regards to its
freebies and ops.
The cost is the result of mutating the expression and getting the storage
size of the difference between the mutated expression and the original.
"""
e_prime = mutate(e, op.body)
# print("e : {}".format(pprint(e)))
# print("e_prime : {}".format(pprint(e_prime)))
if solver.valid(EEq(e, e_prime)):
return ZERO

Expand Down Expand Up @@ -340,12 +344,9 @@ def _maintenance_cost(e : Exp, solver : ModelCachingSolver, op : Op, freebies :
raise NotImplementedError(repr(e.type))

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):
# print("e: {}".format(pprint(x.e)))
for x in all_exps(e):
# print(pprint(op))
if isinstance(x, EStateVar):
res = ESum([
res,
Expand Down

0 comments on commit d4fe6ef

Please sign in to comment.