AI-PSO
view release on metacpan or search on metacpan
examples/NeuralNet/NeuralNet.h view on Meta::CPAN
void setInput(int index, double value)
{
if(index >= 0 && index < m_numInputs)
m_inputs[index].setValue(value);
}
///
/// \fn void setWeightsToOne()
/// \brief sets all of the connections weights to unity
/// \note this is really only used for testing/debugging purposes
///
void setWeightsToOne()
{
for(int i = 0; i < m_numHidden; i++)
for(int j = 0; j < m_hidden[i].numConnections(); j++)
m_hidden[i].setWeight(j, 1.0);
for(int k = 0; k < m_output.numConnections(); k++)
m_output.setWeight(k, 1.0);
}
lib/AI/PSO.pm view on Meta::CPAN
my $meWeight = 'null'; # 'individuality' weighting constant (higher weight (than group) means trust individual more, neighbors less)
my $meMin = 'null'; # 'individuality' minimum random weight (this should really be between 0, 1)
my $meMax = 'null'; # 'individuality' maximum random weight (this should really be between 0, 1)
my $themWeight = 'null'; # 'social' weighting constant (higher weight (than individual) means trust group more, self less)
my $themMin = 'null'; # 'social' minimum random weight (this should really be between 0, 1)
my $themMax = 'null'; # 'social' maximum random weight (this should really be between 0, 1)
my $psoRandomRange = 'null'; # PSO::.86 new variable to support original unmodified algorithm
my $useModifiedAlgorithm = 'null';
#-#-# user/debug parameters #-#-#
my $verbose = 0; # This one defaults for obvious reasons...
#NOTE: $meWeight and $themWeight should really add up to a constant value.
# Swarm Intelligence defines a 'pso random range' constant and then computes two random numbers
# within this range by first getting a random number and then subtracting it from the range.
# e.g.
# $randomRange = 4.0
# $meWeight = random(0, $randomRange);
# $themWeight = $randomRange - $meWeight.
#
( run in 0.976 second using v1.01-cache-2.11-cpan-49f99fa48dc )