23 #include <boost/function.hpp> 39 file.open(
"~/catkin_ws/scds_pso.data");
55 file.open(
"~/catkin_ws/scds_pso.data");
75 for(
int i = 0; i <
dim_; i++) {
79 for(
int i = 0; i <
dim_; i++) {
83 for(
int i = 0; i <
dim_; i++) {
87 for(
int i = 0; i <
dim_; i++) {
91 for(
int i = 0; i <
dim_; i++) {
95 for(
int i = 0; i <
dim_; i++) {
107 for(
int i = 0; i < pos.size(); i++) {
114 for(
int i = 0; i < pos.size(); i++) {
121 for(
int i = 0; i < vel.size(); i++) {
128 for(
int i = 0; i < vel.size(); i++) {
135 for(
int i = 0; i < pos.size(); i++) {
156 for(
int i = 0; i < vel.size(); i++) {
179 for(
int i = 0; i <
dim_; i++) {
216 float r1 = (float)rand()/RAND_MAX;
217 float r2 = (float)rand()/RAND_MAX;
220 for(
int i = 0; i <
dim_; i++) {
284 std::cout<<
"dimension is not set!"<<std::endl;
289 std::cout<<
"fitness is not set!"<<std::endl;
SCDSPSODataTuple get(const std::string &key)
void set_max_vel(const std::vector< float > &pos)
void init_vel(const std::vector< float > &vel)
std::vector< float > cur_pos_
void set_max_pos(const std::vector< float > &pos)
bool has_pos_limit(int index)
boost::function< float(const std::vector< float > &)> fitness_
std::vector< float > min_pos_
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
bool has_vel_limit(int index)
static boost::shared_ptr< T > getSingleton()
void set_min_pos(const std::vector< float > &pos)
void put(const std::string &key, const SCDSPSODataTuple &data)
std::vector< float > min_vel_
void loop(const ros::TimerEvent &)
void init_pos(const std::vector< float > &pos)
void set_param(float w, float c1, float c2)
std::vector< float > max_vel_
std::vector< float > max_pos_
boost::shared_ptr< RuntimeHandle > rth_
void set_fitness(const boost::function< float(const std::vector< float > &)> &fitness)
void set_min_vel(const std::vector< float > &pos)
std::vector< float > cur_vel_
float random_float(float min, float max)