Skip to content

Commit 7bab912

Browse files
authored
Merge pull request #146 from CurricularAnalytics/add_credit_balance
add docstring for credit_balance()
2 parents d677b0f + e39d588 commit 7bab912

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CurricularAnalytics"
22
uuid = "593ffa3d-269e-5d81-88bc-c3b6809c35a6"
33
authors = ["Greg Heileman <gregheileman@gmail.com>", "Hayden Free <haydenwfree@gmail.com>"]
4-
version = "1.5.1"
4+
version = "1.5.2"
55

66
[deps]
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

src/DegreePlanAnalytics.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,20 @@ function requisite_distance(plan::DegreePlan)
140140
return plan.metrics["requisite distance"] = distance
141141
end
142142

143-
#TODO: write docstring, write tests
143+
"""
144+
credit_balance(plan::DegreePlan)
145+
146+
For a given degree plan `plan`, this function computes and returns the credit balance among the terms in a degree plan. A
147+
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
148+
becomes more imbalanced, in terms of the number of credit hours in each tersm, the credit balance grows larger. If ``t_j``
149+
denotes the number of credit hours in term ``j``, ``j = 1 \ldots m,`` then the credit balance of degree plan `p`, denoted by
150+
``cb^p is given by:
151+
152+
```math
153+
cb^p = \\sum_{i=1}^{m-1}\\abs(t_j - t_{j+1})
154+
```
155+
156+
"""
144157
function credit_balance(plan::DegreePlan)
145158
bal = 0
146159
for i in 1:length(plan.terms)-1

0 commit comments

Comments
 (0)