Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fbaeuerlein committed Nov 20, 2013
1 parent 77e9d14 commit f8c32f6
Show file tree
Hide file tree
Showing 8 changed files with 2,650 additions and 0 deletions.
644 changes: 644 additions & 0 deletions AuctionAlgorithm/Auction.h

Large diffs are not rendered by default.

528 changes: 528 additions & 0 deletions AuctionAlgorithm/AuctionCommon.h

Large diffs are not rendered by default.

478 changes: 478 additions & 0 deletions AuctionAlgorithm/AuctionMT.h

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions LSAP.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

#include "AuctionAlgorithm/Auction.h"
#include "AuctionAlgorithm/AuctionMT.h"
#include "Matrix/SparseMatrix.h"
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#include <boost/random/uniform_real_distribution.hpp>
using namespace LSAP;

typedef double Scalar;

typedef Eigen::Matrix<Scalar, -1, -1> WeightMatrix;

int main(int argc, char **argv)
{
const size_t rows = 2000, cols = 5000;

// assert that rows <= cols and coefficients are between 0 and 1!
Eigen::MatrixXd m = Eigen::MatrixXd::Random(rows, cols);

// shift coefficients to get positive values
for ( size_t i = 0; i < rows; ++i)
for ( size_t j = 0; j < cols; ++j )
m(i, j) += 1.;

m /= m.maxCoeff(); // normalize to 0..1

// create sparse matrix from dense
// this could take some time!
// currently there's an own sparse class, might be changed to eigen sparse type
// this matrix type stores the matrix in rowMajor AND colMajor format, so it uses
// a lot of space! (this was due to testing purposes)
SparseMatrix<double> s(m);

// result type
Edges solution;

// single threaded computation and some time measurement
MEASURE_DURATION_SINGLE((solution = Auction<double>::solve(m)));
MEASURE_DURATION_SINGLE((solution = Auction<double, SparseMatrix<double> >::solve(s)));

// multi threaded computation (2 threads) and time measurement
MEASURE_DURATION_SINGLE((solution = AuctionMT<double>::solve(m, 2)));
MEASURE_DURATION_SINGLE((solution = AuctionMT<double, SparseMatrix<double> >::solve(s, 2)));

}
Loading

0 comments on commit f8c32f6

Please sign in to comment.