21 #include "neuralnetui.h"
23 #ifdef FARSA_USE_GRAPHVIZ
24 #include "neuralnetconfwidget.h"
37 #ifdef FARSA_USE_GRAPHVIZ
38 return new NeuralNetUI(
this );
45 if (
observers.contains(observer) )
return;
56 qWarning() <<
"Null Pointer passed to addCluster! This operation will be ignored" ;
63 qWarning() <<
"Cluster already added! addCluster will be ignored" ;
74 if ( !isInput && !isOutput ) {
84 qWarning() <<
"Null Pointer passed to removeCluster! This operation will return false" ;
102 qWarning() <<
"Null Pointer passed to addCluster! This operation will be ignored" ;
109 qWarning() <<
"attempt to mark a Cluster not present in this net!" ;
123 qWarning() <<
"Null Pointer passed to addCluster! This operation will be ignored" ;
130 qWarning() <<
"attempt to mark a Cluster not present in this net!" ;
144 qWarning() <<
"Null Pointer passed to addCluster! This operation will be ignored" ;
151 qWarning() <<
"attempt to unmark a Cluster not present in this net!" ;
171 qWarning() <<
"Null Pointer passed to isIsolato! This operation will return false" ;
197 qWarning() <<
"Null Pointer passed to addLinker! This operation will be ignored" ;
204 qWarning() <<
"Linker already added! addLinker will be ignored" ;
211 qWarning() <<
"The linker that you want add links cluster" << l->
from()->
name() <<
"that doesn't exist in this net! This operation will be ignored" ;
214 if ( !
find( l->
to() ) ) {
215 qWarning() <<
"The linker that you want add links cluster" << l->
to()->
name() <<
"that doesn't exist in this net! This operation will be ignored" ;
231 qWarning() <<
"Null Pointer passed to removeLinker! This operation will return false" ;
252 qWarning() <<
"Null Pointer passed to linkers! This operation will return an empty LinkerList" ;
272 for(
unsigned int i = 0; i<dim; i++ ) {
273 if (
find( u[i] ) ) {
278 qWarning() <<
"In the Updatable order list passed there are some Clusters and/or Linkers not present in this NeuralNet";
288 unsigned int dim = u.size();
289 for(
unsigned int i = 0; i<dim; i++ ) {
290 if (
find( u[i] ) ) {
295 qWarning() <<
"In the Updatable order list passed there are some Clusters and/or Linkers not present in this NeuralNet";
305 for(
int i=0; i<dim; i++ ) {
309 for(
int i=0; i<dim; i++ ) {
315 if (
clsMap.contains( name ) ) {
318 if (
lksMap.contains( name ) ) {
322 qWarning() <<
"getByName: Updatable " << name <<
" not present in BaseNeuralNet";
345 QString myname = prefix;
347 myname.remove( 0, 1 );
355 ClusterList clsToAdd;
356 ClusterList clsInput;
357 ClusterList clsOutput;
361 QStringList subgroups;
364 subgroups << (prefix+sub);
367 QString str = params.
getValue(prefix +
"clustersList");
368 if (!str.isEmpty()) {
369 subgroups << str.split(QRegExp(
"\\s+"), QString::SkipEmptyParts);
371 str = params.
getValue(prefix +
"linkersList");
372 if (!str.isEmpty()) {
373 subgroups << str.split(QRegExp(
"\\s+"), QString::SkipEmptyParts);
375 foreach( QString sub, subgroups ) {
379 if ( cl && !clsToAdd.contains( cl ) ) clsToAdd << cl;
382 if ( ln && !lnsToAdd.contains( ln ) ) lnsToAdd << ln;
385 str = params.
getValue(prefix +
"inputClusters");
386 if (!str.isEmpty()) {
387 QStringList list = str.split(QRegExp(
"\\s+"), QString::SkipEmptyParts);
388 foreach( QString sub, list ) {
390 if ( !clsToAdd.contains( cl ) ) clsToAdd << cl;
395 str = params.
getValue(prefix +
"outputClusters");
396 if (!str.isEmpty()) {
397 QStringList list = str.split(QRegExp(
"\\s+"), QString::SkipEmptyParts);
398 foreach( QString sub, list ) {
400 if ( !clsToAdd.contains( cl ) ) clsToAdd << cl;
405 str = params.
getValue(prefix +
"spreadOrder");
406 if (!str.isEmpty()) {
407 QStringList list = str.split(QRegExp(
"\\s+"), QString::SkipEmptyParts);
409 foreach( QString sub, list ) {
413 if ( cl && !clsToAdd.contains( cl ) ) clsToAdd << cl;
416 if ( ln && !lnsToAdd.contains( ln ) ) lnsToAdd << ln;
421 foreach(
Cluster* cl, clsToAdd ) {
424 foreach(
Cluster* cl, clsInput ) {
427 foreach(
Cluster* cl, clsOutput ) {
430 foreach(
Linker* ln, lnsToAdd ) {
476 Descriptor d =
addTypeDescription( type,
"Neural Network",
"The neural network is a container for Clusters and Linkers. The topology and connectivity of the neural network is specified by the Linkers contained, while the order on which the Clusters and Linkers are updated is specified by the spreadOrder parameter of neural network" );
481 d.
describeObject(
"spreadOrder" ).
type(
"Updatable" ).
props(
IsMandatory |
IsList ).
help(
"The order on which the Clusters and Linkers are updated",
"All Clusters and Linkers specified here are also automatically added into the neural network. If this list contains all Clusters and Linkers, then the clustersList and the linkersList parameters are superfluous" );
483 #ifdef FARSA_USE_GRAPHVIZ
485 setGraphicalEditor<NeuralNetConfWidget>(type);