‘math+econ+code in Paris’ masterclass on optimal transport, choice and matching models at NYU Paris, Jun 17-21, 2019.
In this course, we will primarily using R as our primary programming language. We will also have code available for Python and Julia, but these will be unsupported, so use at your own risk. The code will be presented using Jupyter notebooks, or you can run in RStudio. In addition we will using Gurobi, a commercial linear programming solver. The course will be hosted on github, and I encourage everyone to use git to pull from the repository.
I will provide installation instructions for Windows and Mac users. If you are using Linux, I can trust you can figure it out.
- Go to the R download page, choose whatever mirror you want and install.
- Go to RStudio download page and download and install.
- Compilation of some packages
-
Follow the installation instructions on the Anaconda website, and download the Python 3.7 version.
-
For commands in
conda
Mac users can just use terminal, Windows users should openAnaconda Prompt
. -
Open
R
inconda
by typingR
If
R
is in your path, otherwise navigate there. Default for Windows iscd "C:\Program Files\R\R-3.6.0\bin"
-
Install the R kernel
install.packages('IRkernel') IRkernel::installspec()
-
Open Jupyter notebook using Anaconda Navigator or by typing
jupyter notebook
in conda and open an
R
notebook.
We will need a license to use Gurobi, (which is usually expensive), but there is a academic license that we can use.
-
Go to the Gurobi downloads and click
Gurobi Optimizer
-
You will need to create an 'Academic account'
-
After downloading, visit the Free Academic License page to request the free license. Follow the instructions in README.txt to install the software.
Once installed, open your terminal and run
grbgetkey
using the argument provided, e.g.grbgetkey ae36ac20-16e6-acd2-f242-4da6e765fa0a
The
grbgetkey
program will prompt you to store the license key on your machine, as well as validate your eligibility by confirming your academic domain (e.g., any '.edu' address).Note: you can only validate your license on the network of an academic institution. If you are trying this from home, you will need to use the NYU VPN (look for installation instructions in "Top Support articles".
-
We will need to install some packages in R to get everything working nicely together, but we will save this for later.
-
Install git
- Mac users: open terminal and run
git --version
. If you don't have git installed, you will be prompted to do so. - Windows users: go to the Git for Windows download page and install. I recommend also installing Visual Studio Code for a text editor, unless you already use SublimeText or vim. Alternatively GitHub Desktop is a nice GUI for Git.
- Mac users: open terminal and run
-
Open git
-
Navigate to your home directory
- Mac:
cd /Users/user/my_project
- Windows:
cd /c/user/my_project
- Mac:
-
Clone the mec_optim repo
git clone https://github.com/math-econ-code/mec_optim_2019-06
-
Whenever the repository is updated
git pull origin master
This is only scratching the surface of what we can do with Git and GitHub. It is an amazing way to version control and collaborate on your code. There are lots of great tutorials on how to use both Git and GitHub and I strongly recommend you get into the habit of using it.
Once you have cloned the mec_optim repo, open gurobi_finalsetup.R
in Rstudio and run the code.