21 #include "core/geneticalgoui.h"
22 #include "core/geneticalgo.h"
24 #include "datastreamswidget.h"
26 #include <QGridLayout>
27 #include <QScrollArea>
28 #include <QMetaObject>
45 QList<ParameterSettableUIViewer> viewsList;
46 viewsList.append( fitnessView( parent, flags ) );
51 QVector<double> bests = ga->
bestFits().last();
52 QVector<double> averages = ga->
averageFits().last();
55 QMetaObject::invokeMethod(
this,
"fitPlotsToGenotype", Qt::BlockingQueuedConnection);
58 QVector<float> values;
60 for(
int i=0; i<bests.size(); i++ ) {
62 values[1] = averages[i];
68 QWidget* widget =
new QWidget( parent, flags );
69 QGridLayout* lay =
new QGridLayout( widget );
71 QScrollArea* scroll =
new QScrollArea( widget );
72 lay->addWidget( scroll, 0, 0 );
76 scroll->setWidget( fitnessPlot );
77 scroll->setWidgetResizable(
true );
81 void GeneticAlgoUI::fitPlotsToGenotype() {
82 QVector<double> bests = ga->
bestFits().last();
84 for(
int i=fitnessPlot->
getNumPlots(); i<bests.size(); i++ ) {
85 int id = fitnessPlot->
addPlot( QString(
"Component %1").arg(i) );
86 DataStreamPlot* plot = fitnessPlot->
getPlot(
id);
88 plot->addDataStream(
"Average Fitness" );
89 plot->setDataStreamColor( 0, Qt::red );
90 plot->setDataStreamColor( 1, Qt::blue );