[mlpack-svn] master: Use a deterministic starting point for max-cut test (944a39c)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Tue Jan 6 14:20:52 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/6b14d78fc09cb205ffa7a297f5e6310b2ad83e25...9147fd3ee8072669c18422de4ea6fbe8f964b423
>---------------------------------------------------------------
commit 944a39ce02fedba760ed47d46a65ac42fb99c1c0
Author: Stephen Tu <tu.stephenl at gmail.com>
Date: Sun Jan 4 01:00:39 2015 -0800
Use a deterministic starting point for max-cut test
>---------------------------------------------------------------
944a39ce02fedba760ed47d46a65ac42fb99c1c0
src/mlpack/tests/lrsdp_test.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/mlpack/tests/lrsdp_test.cpp b/src/mlpack/tests/lrsdp_test.cpp
index 312efd7..3045f1a 100644
--- a/src/mlpack/tests/lrsdp_test.cpp
+++ b/src/mlpack/tests/lrsdp_test.cpp
@@ -155,9 +155,13 @@ BOOST_AUTO_TEST_CASE(ErdosRenyiRandomGraphMaxCutSDP)
if (ceil(r) > laplacian.n_rows)
r = laplacian.n_rows;
- std::srand(0xDEADBEEF);
- arma::mat coordinates = arma::randu<arma::mat>(laplacian.n_rows, ceil(r));
- std::srand(std::time(nullptr));
+ // initialize coordinates to a feasible point
+ arma::mat coordinates(laplacian.n_rows, ceil(r));
+ coordinates.zeros();
+ for (size_t i = 0; i < coordinates.n_rows; ++i)
+ {
+ coordinates(i, i % coordinates.n_cols) = 1.;
+ }
LRSDP maxcut(laplacian.n_rows, 0, coordinates);
maxcut.SparseC() = laplacian;
More information about the mlpack-git
mailing list