[shark] 37/58: fixed crossover of NSGAII

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Mar 16 10:05:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository shark.

commit e98af006cda83cef0f498b88d78e8bc1d84dfdd0
Author: Oswin <oswin.krause at di.ku.dk>
Date:   Mon Feb 8 20:13:33 2016 +0100

    fixed crossover of NSGAII
---
 Test/Algorithms/DirectSearch/RealCodedNSGAII.cpp        | 12 ++++++------
 include/shark/Algorithms/DirectSearch/RealCodedNSGAII.h |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Test/Algorithms/DirectSearch/RealCodedNSGAII.cpp b/Test/Algorithms/DirectSearch/RealCodedNSGAII.cpp
index 9377c45..9bc6fd2 100644
--- a/Test/Algorithms/DirectSearch/RealCodedNSGAII.cpp
+++ b/Test/Algorithms/DirectSearch/RealCodedNSGAII.cpp
@@ -60,25 +60,25 @@ BOOST_AUTO_TEST_CASE( RealCodedNSGAII_HYPERVOLUME_Functions ) {
 	reference(1) = 11;
 	DTLZ2 dtlz2(5);
 	double dtlz2Volume = 120.178966;
-	testObjectiveFunctionMOO(dtlz2,10,dtlz2Volume,10000,reference);
+	testObjectiveFunctionMOO(dtlz2,10,dtlz2Volume,1000,reference);
 	DTLZ4 dtlz4(5);
 	double dtlz4Volume = 120.178966;
-	testObjectiveFunctionMOO(dtlz4,10,dtlz4Volume,10000,reference);
+	testObjectiveFunctionMOO(dtlz4,10,dtlz4Volume,5000,reference);
 	//~ DTLZ7 dtlz7(5); //not sure whether correctly implemented
 	//~ double dtlz7Volume = 115.964708;
 	//~ testObjectiveFunctionMOO(dtlz7,10,dtlz7Volume,10000,reference);
 	ZDT1 zdt1(5);
 	double zdt1Volume = 120.613761;
-	testObjectiveFunctionMOO(zdt1,10,zdt1Volume,10000,reference);
+	testObjectiveFunctionMOO(zdt1,10,zdt1Volume,1000,reference);
 	ZDT2 zdt2(5); //fails somehow
 	double zdt2Volume = 120.286820;
-	testObjectiveFunctionMOO(zdt2,10,zdt2Volume,10000,reference);
+	testObjectiveFunctionMOO(zdt2,10,zdt2Volume,1000,reference);
 	ZDT3 zdt3(5);
 	double zdt3Volume = 128.748470;
-	testObjectiveFunctionMOO(zdt3,10,zdt3Volume,10000,reference);
+	testObjectiveFunctionMOO(zdt3,10,zdt3Volume,1000,reference);
 	ZDT6 zdt6(5);
 	double zdt6Volume = 117.483246;
-	testObjectiveFunctionMOO(zdt6,10,zdt6Volume,10000,reference);
+	testObjectiveFunctionMOO(zdt6,10,zdt6Volume,1000,reference);
 }
 
 
diff --git a/include/shark/Algorithms/DirectSearch/RealCodedNSGAII.h b/include/shark/Algorithms/DirectSearch/RealCodedNSGAII.h
index fabb032..e27804a 100644
--- a/include/shark/Algorithms/DirectSearch/RealCodedNSGAII.h
+++ b/include/shark/Algorithms/DirectSearch/RealCodedNSGAII.h
@@ -212,9 +212,9 @@ public:
 			m_pop.end()
 		);
 
-		for( std::size_t i = 1; i < mu(); i++ ) {
+		for( std::size_t i = 0; i < mu()-1; i+=2 ) {
 			if( Rng::coinToss( 0.8 ) ) {
-				m_crossover( m_pop[mu() + i - 1], m_pop[mu() + i] );
+				m_crossover( m_pop[mu() + i ], m_pop[mu() + i +1] );
 			}
 		}
 		for( std::size_t i = 0; i < mu(); i++ ) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/shark.git



More information about the debian-science-commits mailing list