Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

‘math+econ+code in Paris’ masterclass on optimal transport, choice and matching models at NYU Paris, Jun 17-21, 2019

Notifications You must be signed in to change notification settings

math-econ-code/mec_optim_2019-06

Repository files navigation

mec_optim_2019-06

‘math+econ+code in Paris’ masterclass on optimal transport, choice and matching models at NYU Paris, Jun 17-21, 2019.

Getting set up

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.

R and Rstudio

  1. Go to the R download page, choose whatever mirror you want and install.
  2. Go to RStudio download page and download and install.
  3. Compilation of some packages
    1. Windows users should also install Rtools.
    2. Mac user should install Xcode and gfortran, the latter of which can be found here.

Anaconda

  1. Follow the installation instructions on the Anaconda website, and download the Python 3.7 version.

  2. For commands in conda Mac users can just use terminal, Windows users should open Anaconda Prompt.

  3. Open R in conda by typing

    R
    

    If R is in your path, otherwise navigate there. Default for Windows is

    cd "C:\Program Files\R\R-3.6.0\bin"
    
  4. Install the R kernel

    install.packages('IRkernel')
    IRkernel::installspec()
    
  5. Open Jupyter notebook using Anaconda Navigator or by typing

    jupyter notebook
    

    in conda and open an R notebook.

Gurobi

We will need a license to use Gurobi, (which is usually expensive), but there is a academic license that we can use.

  1. Go to the Gurobi downloads and click Gurobi Optimizer

  2. You will need to create an 'Academic account'

  3. 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".

  4. We will need to install some packages in R to get everything working nicely together, but we will save this for later.

Git

  1. 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.
  2. Open git

  3. Navigate to your home directory

    • Mac:cd /Users/user/my_project
    • Windows: cd /c/user/my_project
  4. Clone the mec_optim repo

      git clone https://github.com/math-econ-code/mec_optim_2019-06
    
  5. 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.

Gurobi and R playing nicely

Once you have cloned the mec_optim repo, open gurobi_finalsetup.R in Rstudio and run the code.

About

‘math+econ+code in Paris’ masterclass on optimal transport, choice and matching models at NYU Paris, Jun 17-21, 2019

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •