Merge conflicts

This commit is contained in:
quemy 2012-11-20 22:16:37 +01:00
commit 3ae7dcc60c
12 changed files with 459 additions and 6 deletions

View file

@ -17,7 +17,7 @@ set (TEST_LIST
t-smpMW_eoEasyPSO
t-smpMW_eoSyncEasyPSO
t-smpIsland
#t-smpTopo
t-smpTopo
)
######################################################################################

70
smp/test/t-smpTopo.cpp Normal file
View file

@ -0,0 +1,70 @@
#include <topology/topology.h>
#include <topology/complete.h>
#include <topology/star.h>
#include <topology/ring.h>
#include <iostream>
#include <vector>
using namespace paradiseo::smp;
int main()
{
//Test of Complete Topology
Topology<Complete> topo_comp;
topo_comp.construct(5);
std::cout << std::endl << "---------------" << std::endl << "Test of Complete Topology" << std::endl;
std::vector<unsigned> neighbors=topo_comp.getIdNeighbors(1);
std::cout << "neighbors of Island 1 : "<<std::endl;
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
neighbors=topo_comp.getIdNeighbors(2);
std::cout <<std::endl << "Neighbors of Island 2 : "<<std::endl;
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
//Test of Star Topology
Topology<Star> topo_star;
topo_star.construct(4);
std::cout << std::endl << "---------------" << std::endl << "Test of Star Topology" << std::endl;
neighbors=topo_star.getIdNeighbors(0);
std::cout <<std::endl << "Neighbors of Island 0 : "<<std::endl;
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
neighbors=topo_star.getIdNeighbors(1);
std::cout <<std::endl << "Neighbors of Island 1 : "<<std::endl;
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
//Test of Ring Topology
Topology<Ring> topo_ring;
topo_ring.construct(8);
std::cout << std::endl << "---------------" << std::endl << "Test of Ring Topology" << std::endl;
neighbors=topo_ring.getIdNeighbors(4);
std::cout <<std::endl << "Neighbors of Island 4 : "<<std::endl;
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
neighbors=topo_ring.getIdNeighbors(7);
std::cout <<std::endl << "Neighbors of Island 7 : "<<std::endl;
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
neighbors=topo_ring.getIdNeighbors(0);
std::cout <<std::endl << "Neighbors of Island 0 : "<<std::endl;
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
}