A toolbox for solving problems of equilibrium computation and identification in discrete choice and matching problems.
Switch branches/tags
Nothing to show
Clone or download
Latest commit a8a87dd Jul 10, 2018
Permalink
Failed to load latest commit information.
examples cleanup May 7, 2018
include update OptimLib Jul 10, 2018
src update OptimLib Jul 10, 2018
tests update models May 10, 2018
.codecov.yml update unit tests Aug 18, 2017
.gitignore update gitignore May 7, 2018
.travis.yml remove parallel build May 6, 2018
LICENSE LICENSE Jan 8, 2016
Makefile.in build update May 7, 2018
README.md minor change to build options May 2, 2018
configure update Armadillo repo URL Jun 6, 2018

README.md

TraME   Build Status Build Status

TraME (Transportation Methods for Econometrics) is a C++ library for solving problems of equilibrium computation and estimation in consumer demand and matching frameworks via the Mass Transportation Approach.

Installation and Testing

TraME can be installed via

# clone TraME into the current directory
git clone https://github.com/TraME-Project/TraME ./trame
# build and install
cd ./trame
./configure -i "/usr/local" -p
make
make install

This will install TraME into /usr/local.

There are several configuration options available (./configure -h):

  • -c a coverage build (used with Codecov)
  • -d a 'development' build
  • -g a debugging build (optimization flags set to -O0 -g)
  • -h print help
  • -i install path; default: current directory
  • -l specify the linear programming library to link against, either GLPK (-l glpk) or Gurobi (-l gurobi)
  • -m specify the BLAS and Lapack libraries to link against; for example, -m "-lopenblas" or -m "-framework Accelerate"
  • -o compiler optimization options; defaults to -O3 -march=native -ffp-contract=fast
  • -p enable OpenMP parallelization features

Example

The following example constructs several matching function-based markets under different matching technologies, then solves for equilibrium using the iterated proportional fitting procedure (IPFP) algorithm.

#include "trame.hpp"

int main()
{
    int nbX = 18;      // number of x types
    int nbY = 5;       // number of y types
    double sigma = 1;  // scaling value

    arma::vec n = arma::ones(nbX,1); // number of agents of each type
    arma::vec m = arma::ones(nbY,1);

    // systematic utilities

    arma::mat alpha  = arma::randu(nbX,nbY);
    arma::mat gamma  = arma::randu(nbX,nbY);
    arma::mat lambda = 1 + arma::randu(nbX,nbY);
    arma::mat zeta   = 1 + arma::randu(nbX,nbY);

    arma::mat phi = alpha + gamma;

    arma::mat lambda_LTU = lambda/(lambda+zeta);
    arma::mat phi_LTU = (lambda%alpha + zeta%gamma) / (lambda+zeta);

    // build markets

    trame::mfe<trame::mmfs::geo> mfe_obj_TU(sigma,false);
    mfe_obj_TU.build(n,m,phi); // geometric matching function <=> perfectly transferable utility

    trame::mfe<trame::mmfs::cd> mfe_obj_LTU(sigma,false);
    mfe_obj_LTU.build(n,m,lambda_LTU,phi_LTU); // CD matching function <=> linearly transferable utility

    trame::mfe<trame::mmfs::min> mfe_obj_NTU(sigma,false);
    mfe_obj_NTU.build(n,m,alpha,gamma); // min matching function <=> non-transferable utility

    //

    arma::mat mu_TU, mu_LTU, mu_NTU;

    mfe_obj_TU.solve(mu_TU);
    arma::cout << "Solution of TU-logit problem using ipfp:\n" << mu_TU << arma::endl;

    trame::ipfp(mfe_obj_LTU,mu_LTU);
    arma::cout << "Solution of LTU-logit problem using ipfp:\n" << mu_LTU << arma::endl;

    trame::ipfp(mfe_obj_NTU,mu_NTU);
    arma::cout << "Solution of NTU-logit problem using ipfp:\n" << mu_NTU << arma::endl;
}

Authors

Alfred Galichon and Keith O'Hara

License

GPL (>= 2)

Acknowledgements

Work on TraME is supported by NSF Grant DMS-1716489