From 0dadc099f56291bb65f10567baf1295e0c526e9e Mon Sep 17 00:00:00 2001 From: Jonathan CROUZET <jonathan.crouzet@ensiie.fr> Date: Mon, 17 Oct 2016 10:41:25 +0200 Subject: [PATCH] Debug : Added print functions in Populations --- src/ibea/population.cpp | 29 +++++++++++++++++++++++++++++ src/ibea/population.h | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/src/ibea/population.cpp b/src/ibea/population.cpp index 9f6635c..705e8bb 100644 --- a/src/ibea/population.cpp +++ b/src/ibea/population.cpp @@ -1,6 +1,7 @@ #include <cstdlib> #include <cmath> #include <iostream> +#include <cstdio> #include "../coco/coco.h" #include "indicator.h" @@ -217,3 +218,31 @@ void Population::darwin(double kappa){ } } } + +void Population::printValues(){ + cout << "Values : " << endl; + for (int i=0; i < current_size_; i++){ + for (int j=0; j < dimension_; j++){ + printf("%5f", values_[i][j]); + } + printf("\n"); + } +} + +void Population::printIndicatorValues(){ + cout << "Indicator Values : " << endl; + for (int i=0; i < current_size_; i++){ + for (int j=0; j < current_size_; j++){ + printf("%5f", indicator_values_[i][j]); + } + printf("\n"); + } +} + +void Population::printFitnesses(){ + cout << "Fitnesses : " << endl; + for (int i=0; i < current_size_; i++){ + printf("%5f", fitnesses_[i]); + } + printf("\n"); +} diff --git a/src/ibea/population.h b/src/ibea/population.h index e09da7f..106dd16 100644 --- a/src/ibea/population.h +++ b/src/ibea/population.h @@ -29,6 +29,10 @@ public: void compute_fitnesses(double kappa); void darwin(double kappa); + void printFitnesses(); + void printIndicatorValues(); + void printValues(); + private: int size_; int current_size_; -- GitLab