Newbie question regarding opening files

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.

Maybe I’m in over my head here, but I am trying to run their code - https://github.com/dscotthunter/Fantasy-Hockey-IP-Code

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.

Any help for a newbie would be much appreciated!

-Ryan

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).

The code_for_Github.jl is a Julia script. You can run it from your terminal with:

julia code_for_Github.jl

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.

Any ideas?

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.

https://julialang.org/downloads/oldreleases.html

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.

Another possibility is checking out FemtoCleaner.jl, though I’m not sure if it will work with something as old as 0.3.

1 Like

I got everything running properly. Just had to clean up the GLPK packages. Thanks for all the help everyone.

1 Like

I have the same issues. could you explain what cleaning up GLPK packages means? This is all new to me. Thank you

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!

I can’t help without an MWE.

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:

but I did not try it.

Got it, I appreciate all the input. I will try and give this a try and see what happens. Hope you had a great weekend!