Code Monkey home page Code Monkey logo

trame's Introduction

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

trame's People

Contributors

alfredgalichon avatar kthohr avatar webersimon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

trame's Issues

Rgeogram not compiling on installation (dependency issue?)

Hi there,

I hadn't updated my version of R in several years and, upon updating to R 4.3.2, Rgeogram fails to install. Note that Rgeogram is able to install on R 3.6.0. My colleague has tried in the past to install, but it has always failed for them. I suspect their version of R was always up-to-date.

I attached the full text of the attempted installation. Towards the end it refers to a "_fp" file missing or not found? I'm not too sure what this means. It then follows with

"make: *** [C:/R/etc/x64/Makeconf:272: core_library/src/lib/geogram/third_party/PoissonRecon/Geometry.o] Error 1"

The Rgeogram package has worked amazingly and has been important for our paper so I hope this can be fixed.

Rgeogram_error.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.