Hello and thanks for reading this. I am new to Julia and am attempting to use JuMP to generate entries for Fanduel football tournament contests with a top heavy payoff structure. The code are my modifications to code originally presented in the paper Picking Winners Using Integer Programming by David Hunter, Juan Pablo Vielma, and Tauhid Zaman. My apologies if this not the right place to ask such a question (if so, I would appreciate direction to a more suitable place). I believe I am encountering an easily-fixable error, but so far I am unable to do so. I am using Julia 0.6.0. My code is:
I am not allowed to upload .csv files but to run the code one needs to supply an offense.csv and a defense.csv file that contain the variables and constraints needed to solve the optimization problem. If necessary, I can provide examples and I am uploading a .jpg example of the offense.csv
. The defense.csv file is similar, but lacks a “Position” column (because they are all defenses).Finally, when I attempt to run the code, I get the error:
ERROR: LoadError: UndefVarError: i not defined
Stacktrace:
[1] macro expansion at C:\Users\cbost\.julia\v0.6\JuMP\src\macros.jl:422 [inlined]
[2] one_lineup_Type_3(::DataFrames.DataFrame, ::DataFrames.DataFrame, ::Array{Int64,2}, ::Int64, ::Int64, ::Int64, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Int64, ::Array{Int64,2}, ::Array{Int64,2}) at C:\Users\cbost\Desktop\FanDuel\fanduel.jl:53
[3] create_lineups(::Int64, ::Int64, ::String, ::String, ::#one_lineup_Type_3, ::String) at C:\Users\cbost\Desktop\FanDuel\fanduel.jl:254
[4] include_from_node1(::String) at .\loading.jl:569
[5] include(::String) at .\sysimg.jl:14
while loading C:\Users\cbost\Desktop\FanDuel\fanduel.jl, in expression starting on line 330
It appears there is an index (i) error somewhere in the code, but because the stacktrace just tells me the error is in the final function call, I don’t know how to track it down. I would greatly appreciate any help or suggestions to go about solving this seemingly simple error. Thank you very much for reading this topic!