This is an algorithm for finding good starting points within a constrained optimization problem. It works by simulating "rubber balls" which bounce around inside the constrained region. After many iterations, they tend to be spread somewhat uniformly, even with very complex constrained shapes. The balls learn to approximate the shape of the shell, so if the room is wider than it is tall, the balls will learn to bounce sideways more often than vertically.
More...
#include <GParticleSwarm.h>
|
| GRubberBallSwarm (int dims, int ballCount, GRand *pRand) |
| All of the simulated rubber balls are initialized to the zero-vector, which is assumed to be within the constrained region. More...
|
|
virtual | ~GRubberBallSwarm () |
|
double * | ball (int index) |
| Returns the current vector of the specified ball. More...
|
|
virtual bool | isInside (double *pVec)=0 |
| This method should be implemented to return true iff pVec is within the constrained region. More...
|
|
void | iterate () |
| Simulate another unit of time. More...
|
|
virtual void | onBounce (double *pVec) |
| This method is called when a ball bounces off of the constraint shell. More...
|
|
This is an algorithm for finding good starting points within a constrained optimization problem. It works by simulating "rubber balls" which bounce around inside the constrained region. After many iterations, they tend to be spread somewhat uniformly, even with very complex constrained shapes. The balls learn to approximate the shape of the shell, so if the room is wider than it is tall, the balls will learn to bounce sideways more often than vertically.
GClasses::GRubberBallSwarm::GRubberBallSwarm |
( |
int |
dims, |
|
|
int |
ballCount, |
|
|
GRand * |
pRand |
|
) |
| |
All of the simulated rubber balls are initialized to the zero-vector, which is assumed to be within the constrained region.
virtual GClasses::GRubberBallSwarm::~GRubberBallSwarm |
( |
| ) |
|
|
virtual |
void GClasses::GRubberBallSwarm::advanceBall |
( |
double * |
pBallPos | ) |
|
|
protected |
double* GClasses::GRubberBallSwarm::ball |
( |
int |
index | ) |
|
Returns the current vector of the specified ball.
void GClasses::GRubberBallSwarm::initBall |
( |
double * |
pBall, |
|
|
double |
speed |
|
) |
| |
|
protected |
virtual bool GClasses::GRubberBallSwarm::isInside |
( |
double * |
pVec | ) |
|
|
pure virtual |
This method should be implemented to return true iff pVec is within the constrained region.
void GClasses::GRubberBallSwarm::iterate |
( |
| ) |
|
Simulate another unit of time.
void GClasses::GRubberBallSwarm::mutateBall |
( |
int |
dest, |
|
|
int |
source |
|
) |
| |
|
protected |
virtual void GClasses::GRubberBallSwarm::onBounce |
( |
double * |
pVec | ) |
|
|
inlinevirtual |
This method is called when a ball bounces off of the constraint shell.
double GClasses::GRubberBallSwarm::m_acceleration |
|
protected |
GMatrix GClasses::GRubberBallSwarm::m_balls |
|
protected |
int GClasses::GRubberBallSwarm::m_compareBall |
|
protected |
int GClasses::GRubberBallSwarm::m_condemnedBall |
|
protected |
double GClasses::GRubberBallSwarm::m_condemnedDistance |
|
protected |
int GClasses::GRubberBallSwarm::m_currentBall |
|
protected |
double GClasses::GRubberBallSwarm::m_deceleration |
|
protected |
int GClasses::GRubberBallSwarm::m_dims |
|
protected |
double GClasses::GRubberBallSwarm::m_learningRate |
|
protected |
double* GClasses::GRubberBallSwarm::m_pNormal |
|
protected |
GRand* GClasses::GRubberBallSwarm::m_pRand |
|
protected |
double* GClasses::GRubberBallSwarm::m_pTemp |
|
protected |
int GClasses::GRubberBallSwarm::m_wallPrecisionIters |
|
protected |