LibCudaOptimize
1.0
|
Particle Swarm Optimization. More...
#include <PSO_Optimizer.h>
Public Member Functions | |
PSO_Optimizer (EvalFuncPtr fPtr=NULL, unsigned int dn=PROBLEM_DIMENSIONS, unsigned int sn=NUM_SETS, unsigned int pn=NUM_SOLUTIONS) | |
see IOptimizer::IOptimizer | |
virtual bool | init () |
Initialize the optimizer. | |
virtual void | free () |
Free memory. | |
void | setInertia (float w) |
set inertia value | |
void | setC1 (float c1) |
set value of parameter C1 | |
void | setC2 (float c2) |
set value of parameter C2 | |
void | setTopology (TOPOLOGY topology) |
set neighborhood topology | |
float * | getBestSolution () |
get best solutions of all sets | |
float * | getBestSolution (unsigned int sid) |
get best solution of the set indicated by the index sid | |
float * | getBestFitnesses () |
get a pointer to best fitnesses of all sets | |
float | getBestFitness (unsigned int sid) |
get value of the best fitness for set indicated by the index sid | |
Protected Member Functions | |
virtual void | initSolutions (dim3, dim3) |
Initialize solutions. | |
virtual void | fitnessEvaluation (dim3, dim3, bool first=false) |
Evaluate solutions. | |
virtual void | step (dim3, dim3) |
Generate solutions for subsequent fitnessEvaluation. | |
virtual void | update (dim3, dim3, bool first=false) |
Update population according to the algorithm and the results of fitnessEvaluation. | |
virtual void | findBest () |
Updates global best fitnesses, indexes in SolutionSet device memory. |
Particle Swarm Optimization.
Code based on http://www.ce.unipr.it/people/mussi/projects/CUDA-PSO-v1.0-html_documentation
Definition at line 40 of file PSO_Optimizer.h.
virtual void PSO_Optimizer::fitnessEvaluation | ( | dim3 | initializationGrid, |
dim3 | initializationBlock, | ||
bool | first = false |
||
) | [protected, virtual] |
Evaluate solutions.
initializationGrid | organization of the CUDA blocks |
initializationBlock | organization of the CUDA threads |
first | it signals if it is the first evaluation of the optimization |
Implements IOptimizer.
virtual void PSO_Optimizer::initSolutions | ( | dim3 | initializationGrid, |
dim3 | initializationBlock | ||
) | [protected, virtual] |
Initialize solutions.
initializationGrid | organization of the CUDA blocks |
initializationBlock | organization of the CUDA threads |
Implements IOptimizer.
void PSO_Optimizer::setTopology | ( | TOPOLOGY | topology | ) | [inline] |
set neighborhood topology
Actually implemented:
LBEST ring topology with neighborhood size 2 GBEST global topology STAR star topology
Definition at line 91 of file PSO_Optimizer.h.
virtual void PSO_Optimizer::step | ( | dim3 | initializationGrid, |
dim3 | initializationBlock | ||
) | [protected, virtual] |
Generate solutions for subsequent fitnessEvaluation.
initializationGrid | organization of the CUDA blocks |
initializationBlock | organization of the CUDA threads |
Implements IOptimizer.
virtual void PSO_Optimizer::update | ( | dim3 | initializationGrid, |
dim3 | initializationBlock, | ||
bool | first = false |
||
) | [protected, virtual] |
Update population according to the algorithm and the results of fitnessEvaluation.
initializationGrid | organization of the CUDA blocks |
initializationBlock | organization of the CUDA threads |
first | it signals if it is the first evaluation of the optimization |
Implements IOptimizer.