I have no background with computer programming, but am a daily fantasy sports player. I recently came across a paper - “Picking Winners Using Integer Programming” by David Hunter, Juan Pablo Vielma, and Tauhid Zaman.
I’ve successfully downloaded and run all of the required software, as instructed on the GitHub page.
I downloaded the code in the zip file to my machine (I placed it on my desktop).
Under “running the code” it says to “open the file code_for_Github.jl” When I type “code_for_Github.jl” into Julia it comes back with “ERROR: UndefVarError: code_for_Github not defined”
I’m assuming I am doing something wrong, but just not sure how to proceed to get this code run.
I have not looked at their source code, but a general comment I can make is that this particular code is 2 years old and there has been rapid development in both JuMP and Julia itself over that time. Since Julia is still in alpha breaking changes are not uncommon. This situation will change soon with the release of Julia 0.7 (the “true” beta for 1.0). It’s likely that changes would have to be made to the source code to get it to run correctly. If you are serious about using this, you should look for someone to update the code for current Julia and JuMP versions (probably not difficult).
So I figured out the initial problem was that I hadn’t properly set my home directory. I got that all sorted out, and tried to run the code…but ended up with this error:
ERROR: LoadError: UndefVarError: GLPKSolverMIP not defined
Stacktrace:
[1] one_lineup_Type_4(::DataFrames.DataFrame, ::DataFrames.DataFrame, ::Array{Int64,2}, ::Int64, ::Int64, ::Int64, ::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,1}, ::Int64, ::Array{Int64,2}, ::Array{Int64,2}, ::Array{Int64,2}, ::Int64, ::Array{Int64,2}) at /Users/kelseykeith/Desktop/code_for_Github.jl:411
[2] create_lineups(::Int64, ::Int64, ::String, ::String, ::#one_lineup_Type_4, ::String) at /Users/kelseykeith/Desktop/code_for_Github.jl:803
[3] include_from_node1(::String) at ./loading.jl:576
[4] include(::String) at ./sysimg.jl:14
while loading /Users/kelseykeith/Desktop/code_for_Github.jl, in expression starting on line 873
I searched Google for this error and nothing came up. I made sure to Pkg.add(“GLPKMathProgInterface”) and it came back saying it was already installed.
I didn’t take a good look, but “Since Julia is still in alpha breaking changes are not uncommon […] It’s likely that changes would have to be made to the source code to get it to run correctly.” isn’t too helpful.
Since the code ran at some point, you just need to have the julia runtime from that time.
I’m guessing it is Julia 0.3. You also need the libraries used at that time with this code. Usually there’s a REQUIRE file that tells you what you need and the minimum version number. Those old version you require no longer work with newer Julia. Waiting for 1.0 will not help, but finding the old software probably will.
I would guess that @ajimithing fixed up the relevant packages, but since I see no commits for either GLPKMathProgInterface.jl or GPLK.jl in the last month, I assume that they have not been submitted as a pull request.
@Tamas_Papp I am trying to get the code running as well and have made a few changes to get it updated but now running into a LoadError: UndefVarError: i not defined error. Would you be able to help me get it running? I appreciate your time!
Generally, regarding the code in the Fantasy Hockey repository: it would be best if someone forked it on Github and updated everything. It is an example that draws many people to Julia, but at the same time it has not been updated for a while. Maybe this fork works: