From 2214eba62c5c998b8d843ea9ebbbbd3abd86788b Mon Sep 17 00:00:00 2001 From: "B. Bogart" Date: Thu, 2 Oct 2003 14:02:07 +0000 Subject: Added the Codewarrior Project file for MAX and the MAX help patch. svn path=/trunk/externals/bbogart/; revision=1060 --- pso/main.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'pso/main.cpp') diff --git a/pso/main.cpp b/pso/main.cpp index 1ebc296..1940993 100644 --- a/pso/main.cpp +++ b/pso/main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include // check for appropriate flext version #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400) @@ -99,10 +100,11 @@ FLEXT_NEW_3("pso",pso, int,int,int) pso::pso(int Popsize, int Dimen, int HoodSize) { // Say hello - post("--------------------------------------------\nParticle Swarm Optimizer (PSO)\nCopyright Ben Bogart 2003.\nBased on code by Thomas Grill & Jim Kennedy.\n--------------------------------------------"); - - // var defines - int i,j,k; + post("--------------------------------------------"); + post("Particle Swarm Optimizer (PSO)"); + post("Copyright Ben Bogart 2003."); + post("Based on code by Thomas Grill & Jim Kennedy."); + post("--------------------------------------------"); // default vars this->Min = 0; @@ -126,7 +128,7 @@ pso::pso(int Popsize, int Dimen, int HoodSize) // define inlets: // first inlet must always by of type anything (or signal for dsp objects) - AddInAnything(); // add one inlet for any message + AddInAnything("Send 'help' message for details..."); // add one inlet for any message // define outlets: AddOutList("Particle positions."); @@ -252,7 +254,7 @@ void pso::set_pop(int argc,t_atom *argv) void pso::set_particle(int argc,t_atom *argv) { - int i,particle,in,out; + int i,particle; // If the number of arguments matches the number of dimensions plus the index value if ( argc == this->dimen+1 ) @@ -295,7 +297,7 @@ void pso::set_target(int argc,t_atom *argv) { for (i=0; itarget[i] = GetFloat(argv[i]); + this->target[i] = GetAFloat(argv[i]); } post("%s: Target Set.", thisName() ); } else { @@ -428,7 +430,7 @@ void pso::iterate() void pso::output_positions() { - int d,p,atoms; + int d,p; t_atom atom; t_atom p_atom; AtomList list; @@ -440,7 +442,7 @@ void pso::output_positions() list.Clear(); // start the lists with the index of the particle - SetFloat(p_atom, (float)p ); + SetInt(p_atom, p ); list.Append(p_atom); for (d=0; d< this->dimen; d++) -- cgit v1.2.1