Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

A toolbox for solving problems of equilibrium computation and identification in discrete choice and matching problems.

Topics

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.