using CurricularAnalytics, CurricularVisualization #using CurricularOptimization # this package requires special access rights, if you commented out, you won't be able to run the optimzation-related functions using Glob using CSV using DataFrames using Statistics UA_ChemE_plan = read_csv("./programs/plans/ChemE-DP-UA.csv") visualize(UA_ChemE_plan, notebook=true) metrics = basic_metrics(UA_ChemE_plan) println(String(take!(metrics))) metrics = basic_metrics(UA_ChemE_plan.curriculum) println(String(take!(metrics))) df = DataFrame(CSV.File("./Complexity_x_Grad_UA.csv")); histogram(df.complexity_score, nbins=50, xlabel="Program Complexity", ylabel="# of programs", label="") = Array{Integer,1}() # curricular complexity score of program Y = Array{Bool,1}() # did student graduate within 4 years? Z = Array{Bool,1}() # did student graduate within 6 years? for row in eachrow(df) for t in 1:row["four"] push!(X, row["complexity_score"]) push!(Y, 1); push!(Z, 1) end s = row["total_degrees_awarded"] - row["six"] for t in 1:(row["total_degrees_awarded"] - row["four"]) push!(X, row["complexity_score"]) push!(Y, 0) s > 0 ? (push!(Z, 1); s=s-1) : push!(Z, 0) end end df_binary = DataFrame(Program_Complexity = X, grad4 = Y, grad6 = Z); histogram(X, nbins=50, xlabel="Program Complexity", ylabel="# of students", label="") probit4 = glm(@formula(grad4 ~ Program_Complexity), df_binary, Binomial(), ProbitLink()) probit6 = glm(@formula(grad6 ~ Program_Complexity), df_binary, Binomial(), ProbitLink()) CC_scores = DataFrame(Program_Complexity = 0:10:650) pred4 = predict(probit4, CC_scores, interval = :confidence) pred6 = predict(probit6, CC_scores, interval = :confidence) plot(title="Graduates") plot!(CC_scores.Program_Complexity, pred4.prediction , seriestype = :scatter, labels="4 years", ribbon = (pred4.prediction .- pred4.lower, pred4.upper .- pred4.prediction)) plot!(CC_scores.Program_Complexity, pred6.prediction , seriestype = :scatter, labels="6 years", ribbon = (pred6.prediction .- pred6.lower, pred6.upper .- pred6.prediction)) currics = Array{Curriculum,1}() program_files = glob("*", "./programs/curricula") for program in program_files curric = read_csv(program) complexity(curric) # compute the curricular complexity of the curriculum push!(currics, curric) # store the curriculum in the darray end for c in currics println(c.institution) end metric = "complexity" stats = basic_statistics(currics, "complexity") println(String(take!(stats))); flush(stdout) display(metric_histogram(currics, metric, title="Chemical Engineering Programs", xlabel="$(metric)", ylabel="# of curricula", xlim=(0,900))) metrics = basic_metrics(AE_plan.curriculum) println(String(take!(metrics))) metrics = basic_metrics(EE_plan.curriculum) println(String(take!(metrics))) curricula = Array{Curriculum,1}() metric = "complexity" for (key, val) in plans push!(curricula, val.curriculum) end display(metric_histogram(curricula, metric, title=" Programs", xlabel="$(metric)", ylabel="# of curricula", xlim=(0,500))) for plan in plans extraneous_requisites(plan[2].curriculum, print=true) end prefixes = Dict{String, Array{String,1}}() prefixes["Electrical Engineering"] = ["ECE"]; prefixes["Electrical Engineering - Electronic Devices and Circuit Technology"] = ["ECE"]; prefixes["Aerospace Engineering"] = ["AE"]; for plan in plans de = dead_ends(plan[2].curriculum, prefixes[plan[2].curriculum.name]) println("\nDead end courses in the $(plan[2].curriculum.name) curriculum:") for course in de[2] println("$(course.prefix) $(course.num): $(course.name)") end end # Uncomment the following two lines if the Gurobi package has not yet been included in your Julia environment. #using Pkg #Pkg.add("Gurobi") using Gurobi metrics = basic_metrics(EE_plan) println(String(take!(metrics))) EE_new_1 = optimize_plan(EE_plan.curriculum, 8, 12, 18, balance_obj); visualize(EE_new_1, notebook=true) metrics = basic_metrics(EE_new_1) println(String(take!(metrics))) #curric = deepcopy(EE_plan.curriculum) #convert_ids(curric) #toxic = Array{Pair{Course,Course},1}() # Differential Calc is toxic to Linear Algebra #push!(toxic, course(curric, "MATH", "1551", "Differential Calculus", "") => course(curric, "MATH", "1554", "Linear Algebra", "")) EE_new_2 = optimize_plan(EE_plan.curriculum, 8, 12, 18, req_distance_obj); visualize(EE_new_2, notebook=true) metrics = basic_metrics(EE_new_2) println(String(take!(metrics))) EE_new_3 = optimize_plan(EE_plan.curriculum, 8, 12, 18, [balance_obj, req_distance_obj]); visualize(EE_new_3, notebook=true) metrics = basic_metrics(EE_new_3) println(String(take!(metrics))) #EE_new_4 = optimize_plan(EE_plan.curriculum, 8, 12, 18, [balance_obj, req_distance_obj], toxic_courses=toxic); #visualize(EE_new_4, notebook=true)