Class ClubsTopology
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
The clubs topology, after H. M. Emara, "Adaptive Clubs-based Particle Swarm Optimization": each particle belongs to a
default number of clubs, and its social best is the best of its clubs' members; a club's best leaves a random club
(down to a minimum) and its worst joins one (up to a maximum), and every reset iterations the others return to the
default: QuantLib's ClubsTopology.
[Experimental("NQL0001")]
public sealed class ClubsTopology : ParticleSwarmOptimizationTopology
- Inheritance
-
ClubsTopology
- Inherited Members
Remarks
Fixes (Divergences/ParticleSwarmTopologyTests.cs): the initial clubs are drawn in [0, totalClubs − 1], where
QuantLib's draws in [1, totalClubs] and reads one past each particle's clubs; a particle's social best is its best
club's best particle, where QuantLib's takes the club's index for a particle; each club's worst is weighed over
every member, where QuantLib's tests it only on a member that isn't the new best, so a club whose values fall in
order names particle 0 its worst, a member or not; and a best particle leaves a club only above the minimum and a
worst one joins only below the maximum, as the class documents, where QuantLib's never tests either, so a particle
that stays best leaves every club and its social best is then the largest double. A club none of whose members
passes QuantLib's comparisons, one with no members or whose personal bests are all NaN, has no best, and a particle
reads only its clubs with a best, or its own personal best where none has one, where QuantLib's reads particle 0, a
member or not, for such a club; a minimum below 1 is refused, as a particle in no club has no club-mates and so no
social best, where QuantLib's best particle leaves every club and keeps particle 0's position at the largest double.
Its integers are std::uniform_int_distribution's on a std::mt19937 on the seed, drawn as MSVC draws
them; the seed is required, QuantLib's default seeding from the clock. Each minimization starts the generator from
the seed and the iterations from 0.
Constructors
ClubsTopology(int, int, int, int, int, long)
Initializes a new instance of the ClubsTopology class.
public ClubsTopology(int defaultClubs, int totalClubs, int maxClubs, int minClubs, int resetIteration, long seed)
Parameters
defaultClubsintThe clubs each particle starts in.
totalClubsintThe clubs.
maxClubsintThe most clubs a particle joins.
minClubsintThe fewest clubs a particle keeps.
resetIterationintThe iterations between resets to the default.
seedlongThe seed, in [1, 4294967295].
Exceptions
- ArgumentException
The club counts are out of order, with QuantLib's texts.
- ArgumentOutOfRangeException
minClubsis below 1, orseedis outside [1, 4294967295].
Methods
Clone()
A copy for a minimization, unbound, its generators at their seeds.
public override ParticleSwarmOptimizationTopology Clone()
Returns
- ParticleSwarmOptimizationTopology
The copy.
FindSocialBest()
Sets each particle's social best for the iteration (QuantLib's findSocialBest).
public override void FindSocialBest()
Exceptions
- NanoQLException
The topology isn't bound to a minimization's swarm, where QuantLib reads clubs
setSizehasn't made.
SetSize(int)
Initializes the state for the problem (QuantLib's setSize).
public override void SetSize(int M)
Parameters
MintThe swarm's size.