[mlpack-git] master: Use a deterministic starting point for max-cut test (7731c69)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:10:15 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit 7731c6964c7e4de999ce39fcb57ed82bdec85ce9
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
>---------------------------------------------------------------
7731c6964c7e4de999ce39fcb57ed82bdec85ce9
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