Skip to content

Commit cb02eb5

Browse files
committed
update unit tests
1 parent 27f1450 commit cb02eb5

File tree

16 files changed

+311
-37
lines changed

16 files changed

+311
-37
lines changed

.codecov.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ coverage:
1414

1515
ignore:
1616
- "src/optim/"
17-
- "src/lp"
18-
- "src/lp/*"
1917

2018
parsers:
2119
gcov:

include/solvers/ipfp.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,14 @@ bool ipfp(const mfe<Tt>& market, arma::mat& mu_out, const arma::vec& by_start);
5454
template<typename Tt>
5555
bool ipfp(const mfe<Tt>& market, arma::mat& mu_out, const double err_tol_inp, const int max_iter_inp);
5656

57-
template<typename Tt>
58-
bool ipfp(const mfe<Tt>& market, arma::mat& mu_out, const double err_tol_inp, const arma::vec& by_start);
59-
60-
template<typename Tt>
61-
bool ipfp(const mfe<Tt>& market, arma::mat& mu_out, const int max_iter_inp, const arma::vec& by_start);
62-
6357
template<typename Tt>
6458
bool ipfp(const mfe<Tt>& market, arma::mat& mu_out, const double err_tol_inp, const int max_iter_inp, const arma::vec& by_start);
6559

6660
template<typename Tt>
6761
bool ipfp(const mfe<Tt>& market, arma::mat& mu_out, arma::mat& U_out, arma::mat& V_out);
6862

6963
template<typename Tt>
70-
bool ipfp(const mfe<Tt>& market, arma::mat& mu_out, arma::vec& mu_x0_out, arma::vec& mu_0y_out, arma::mat& U_out, arma::mat& V_out, arma::vec& u_out, arma::vec& v_out, double* err_tol_inp, int* max_iter_inp, arma::vec* by_start);
64+
bool ipfp(const mfe<Tt>& market, arma::mat& mu_out, arma::vec& mu_x0_out, arma::vec& mu_0y_out, arma::mat& U_out, arma::mat& V_out, arma::vec& u_out, arma::vec& v_out, const double* err_tol_inp, const int* max_iter_inp, const arma::vec* by_start);
7165

7266
#include "ipfp.tpp"
7367

include/solvers/ipfp.tpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ipfp_int(const mfe<Tt>& market, arma::mat* mu_out, arma::vec* mu_x0_out, arma::v
5656

5757
int iter = 0;
5858
double err = 2*err_tol;
59-
59+
6060
while (err > err_tol && iter < max_iter) {
6161
iter++;
6262

@@ -77,7 +77,7 @@ ipfp_int(const mfe<Tt>& market, arma::mat* mu_out, arma::vec* mu_x0_out, arma::v
7777

7878
//
7979
// Construct the equilibrium outcome based on 'ax' and 'by' obtained above
80-
80+
8181
if (mu_out || mu_x0_out || mu_0y_out || U_out || V_out || u_out || v_out) {
8282

8383
arma::mat mu = market.mmfs_obj.M(ax,by);
@@ -96,7 +96,7 @@ ipfp_int(const mfe<Tt>& market, arma::mat* mu_out, arma::vec* mu_x0_out, arma::v
9696
if (mu_0y_out) {
9797
*mu_0y_out = mu_0y;
9898
}
99-
99+
100100
if (U_out) {
101101
//*U_out = arma::log(mu / arma::repmat(mu_x0,1,mu.n_cols));
102102
*U_out = arma::log(elem_div(mu,mu_x0));
@@ -106,7 +106,7 @@ ipfp_int(const mfe<Tt>& market, arma::mat* mu_out, arma::vec* mu_x0_out, arma::v
106106
*V_out = arma::trans(arma::log(elem_div(mu.t(),mu_0y)));
107107
}
108108

109-
if (u_out) {
109+
if (u_out) {
110110
*u_out = - arma::log(mu_x0);
111111
}
112112
if (u_out) {
@@ -156,20 +156,6 @@ ipfp(const mfe<Tt>& market, arma::mat& mu_out, const double err_tol_inp, const i
156156
return ipfp_int(market,&mu_out,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,&err_tol_inp,&max_iter_inp,nullptr);
157157
}
158158

159-
template<typename Tt>
160-
bool
161-
ipfp(const mfe<Tt>& market, arma::mat& mu_out, const double err_tol_inp, const arma::vec& by_start)
162-
{
163-
return ipfp_int(market,&mu_out,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,&err_tol_inp,nullptr,&by_start);
164-
}
165-
166-
template<typename Tt>
167-
bool
168-
ipfp(const mfe<Tt>& market, arma::mat& mu_out, const int max_iter_inp, const arma::vec& by_start)
169-
{
170-
return ipfp_int(market,&mu_out,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,&max_iter_inp,&by_start);
171-
}
172-
173159
template<typename Tt>
174160
bool
175161
ipfp(const mfe<Tt>& market, arma::mat& mu_out, const double err_tol_inp, const int max_iter_inp, const arma::vec& by_start)

src/mmfs/mmfs_cd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* 08/15/2016
3030
*
3131
* This version:
32-
* 07/24/2017
32+
* 08/18/2017
3333
*/
3434

3535
#include "ancillary/ancillary.hpp"

tests/cov_setup

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ cd ../mmfs
4040
make
4141
./cov_check
4242

43+
cd ../solvers
44+
./configure -b dev -c
45+
make
46+
./cov_check
47+
4348
cd ../transfers
4449
./configure -b dev -c
4550
make

tests/solvers/ipfp.cpp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
1+
/*################################################################################
2+
##
3+
## Copyright (C) 2015 - 2017 the TraME Team:
4+
## Alfred Galichon
5+
## Keith O'Hara
6+
##
7+
## This file is part of TraME.
8+
##
9+
## TraME is free software: you can redistribute it and/or modify
10+
## it under the terms of the GNU General Public License as published by
11+
## the Free Software Foundation, either version 2 of the License, or
12+
## (at your option) any later version.
13+
##
14+
## TraME is distributed in the hope that it will be useful,
15+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
## GNU General Public License for more details.
18+
##
19+
## You should have received a copy of the GNU General Public License
20+
## along with TraME. If not, see <http://www.gnu.org/licenses/>.
21+
##
22+
################################################################################*/
23+
124
/*
225
* ipfp test
326
*
427
* Keith O'Hara
528
* 10/24/2016
6-
*
7-
* cd ~/Desktop/SCM/GitHub/TraME/src/trame/tests/equilibrium
829
*
9-
* g++-mp-5 -O2 -Wall -std=c++11 -I/opt/local/include -I./../../headers -I/usr/local/include ipfp_test.cpp -o ipfp.test -L/opt/local/lib -ltrame -framework Accelerate
30+
* This version:
31+
* 08/18/2017
1032
*/
1133

1234
#include "trame.hpp"

tests/unit_tests/arums/empirical.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* 05/17/2016
2929
*
3030
* This version:
31-
* 07/03/2017
31+
* 08/18/2017
3232
*/
3333

3434
#include "trame.hpp"

tests/unit_tests/arums/logit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* 05/17/2016
2929
*
3030
* This version:
31-
* 07/03/2017
31+
* 08/18/2017
3232
*/
3333

3434
#include "trame.hpp"

tests/unit_tests/arums/none.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* 05/17/2016
2929
*
3030
* This version:
31-
* 07/03/2017
31+
* 08/18/2017
3232
*/
3333

3434
#include "trame.hpp"

tests/unit_tests/arums/probit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* 05/17/2016
2929
*
3030
* This version:
31-
* 07/03/2017
31+
* 08/18/2017
3232
*/
3333

3434
#include "trame.hpp"

0 commit comments

Comments
 (0)