10 #define test(s) {cout << s <<  " " << flush;} 
   11 #define testOk() {cout << "OK" << endl;} 
   17         operator double()
 const {
return w; }
 
   23         for (vector<Particle>::const_iterator it=p.begin(); it!=p.end(); ++it) {
 
   24                 os << it->p.x << 
" " << it->p.y << endl;
 
   32                 pn.
p.x+=10*(drand48()-.5);
 
   33                 pn.
p.y+=10*(drand48()-.5);
 
   45                 std::vector<double>::const_iterator oit=observations.begin();
 
   46                 for (std::vector<Point>::const_iterator it=observerVector.begin(); it!=observerVector.end();it++){
 
   47                         v*=exp(-pow(((p.
p-*it)*(p.
p-*it)-*oit*(*oit))/sigma, 2));
 
   50                 cout << 
"#v=" << v << endl;
 
   55 int main (
unsigned int argc, 
const char * 
const * argv){
 
   56         vector<Particle> particles(1000);
 
   61         for (vector<Particle>::iterator it=particles.begin(); it!=particles.end(); it++){
 
   63                 it->p.x=400*(drand48()-.5);
 
   64                 it->p.y=400*(drand48()-.5);
 
   67         vector<Point> sensors;
 
   69         sensors.push_back(
Point(-50,0));
 
   70         sensors.push_back(
Point(50,0));
 
   71         sensors.push_back(
Point(0,100));
 
   73         likelyhoodModel.
sigma=1000;
 
   82                 vector<Particle> newgeneration;
 
   84                 cout << 
"# SIR step" << endl;
 
   86                 for (vector<Particle>::iterator it=particles.begin(); it!=particles.end(); it++){
 
   90                 ofstream os(
"sir.dat");
 
   93                 vector<Particle> newpart=resampler.
resample(particles);
 
   96                 cout << 
"plot [-200:200][-200:200]\"sir.dat\" w p" << endl;