Skip to content

Commit

Permalink
add docstring for credit_balance()
Browse files Browse the repository at this point in the history
  • Loading branch information
heileman authored and haydenfree committed Jun 14, 2024
1 parent 993b1a4 commit 928422d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/DegreePlanAnalytics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,20 @@ function requisite_distance(plan::DegreePlan)
return plan.metrics["requisite distance"] = distance
end

#TODO: write docstring, write tests
"""
credit_balance(plan::DegreePlan)
For a given degree plan `plan`, this function computes and returns the credit balance among the terms in a degree plan. A
score of `0` indicates perfect balance, i.e., each term in the degree plan has the same number of credit hours. As a degree plan
becomes more imbalanced, in terms of the number of credit hours in each tersm, the credit balance grows larger. If ``t_j``
denotes the number of credit hours in term ``j``, ``j = 1 \ldots m,`` then the credit balance of degree plan `p`, denoted by
``cb^p is given by:
```math
cb^p = \\sum_{i=1}^{m-1}\\abs(t_j - t_{j+1})
```
"""
function credit_balance(plan::DegreePlan)
bal = 0
for i in 1:length(plan.terms)-1
Expand Down

0 comments on commit 928422d

Please sign in to comment.