diff --git a/src/DegreePlanAnalytics.jl b/src/DegreePlanAnalytics.jl index d45fd2b..c29e449 100644 --- a/src/DegreePlanAnalytics.jl +++ b/src/DegreePlanAnalytics.jl @@ -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