void vrpRoute::Serialize(edaBuffer &buf, bool pack ){ if ( pack ){ unsigned int size = this->size(); buf.Pack( &size, 1 ); for (unsigned int i=0; i< size; i++) { vrpSubRoute* sub = this->at(i); sub->doSerialize( buf,pack); } } else { unsigned int size; buf.UnPack( &size, 1 ); if(this->size() > 0) { for(unsigned int i = 0; i < this->size(); i++) { vrpSubRoute* sub = this->at(i); delete sub; } } this->clear(); for (unsigned int i = 0; i < size; i++) { vrpSubRoute* sub = (vrpSubRoute*)classGenerateFromBuffer( buf ); this->push_back(sub); } } }
void edaRankSelection::Serialize( edaBuffer &buf, bool pack ) { if(pack) { buf.Pack(&rate,1); } else { easer(); buf.UnPack(&rate,1); } }
void airNeighbourMove::Serialize( edaBuffer &buf, bool pack ) { if(pack) { buf.Pack(&first); buf.Pack(&second); } else { buf.UnPack(&first); buf.UnPack(&second); } }
void airNeighbourRand::Serialize( edaBuffer &buf, bool pack ) { if(pack) { buf.Pack(&count); buf.Pack(&num); } else { buf.UnPack(&count); buf.UnPack(&num); } }
void schedSwapArea::serialize(edaBuffer& buf, bool pack) { schedNeighbour::serialize(buf, pack); if(pack) { buf.pack( &_first ); buf.pack( &_second ); } else { buf.unpack( &_first ); buf.unpack( &_second ); } }
void vrpGroupConflict::Serialize(edaBuffer &buf, bool pack) { if ( pack ) { buf.Pack( &_size, 1 ); buf.Pack( _matrix, _size * _size ); } else { easer(); buf.UnPack( &_size, 1 ); _matrix = new bool[_size * _size]; buf.UnPack( _matrix, _size * _size ); } }
void edaExpCoolingSchedule::Serialize(edaBuffer &buf, bool pack) { edaCoolingSchedule::Serialize(buf, pack); if (pack) { buf.Pack(&threshold, 1); buf.Pack(&ratio, 1); } else { buf.UnPack(&threshold, 1); buf.UnPack(&ratio, 1); } }
void edaPopulation::Serialize( edaBuffer &buf, bool pack ) { if(pack) { unsigned int _size = size(); buf.Pack(&_size, 1); for(unsigned int i = 0; i < _size; i++) { at(i)->doSerialize(buf,pack); } } else { easer(); unsigned int _size; buf.UnPack(&_size,1); resize(_size); for(unsigned int i = 0; i < _size; i++) { at(i) = (edaChromosome*)classGenerateFromBuffer(buf); } } }
void edaSA::Serialize( edaBuffer &buf, bool pack ) { edaSearch::Serialize(buf, pack); if ( pack ){ move->doSerialize( buf, pack ); moveRandom->doSerialize( buf, pack ); con->doSerialize( buf, pack ); coolingSchedule->doSerialize( buf, pack ); buf.Pack( &initTemperature, 1 ); } else { move = (edaMove*)classGenerateFromBuffer( buf ); moveRandom = (edaMoveGen*)classGenerateFromBuffer( buf ); con = (edaContinue*)classGenerateFromBuffer( buf ); coolingSchedule = (edaCoolingSchedule*)classGenerateFromBuffer( buf ); buf.UnPack( &initTemperature, 1 ); } }
void edaSerialize::doSerialize(edaBuffer &buf, bool pack) { if (pack) { int clsid = getClassID(); buf.Pack(&clsid, 1); } this->Serialize(buf, pack); }
void edaChromosome::Serialize( edaBuffer &buf, bool pack ) { if (pack) { unsigned int size = list.size(); buf.Pack(&size, 1); for(unsigned int i = 0; i < size; i++) { edaGenne *genne = list[i]; genne->doSerialize(buf,pack); } buf.Pack(&fitness,1); } else { easer(); unsigned int size; buf.UnPack(&size, 1); list.resize(size); for (unsigned int i = 0; i < size; i++) list[i] = (edaGenne*)classGenerateFromBuffer(buf); buf.UnPack(&fitness,1); } }
void vrpSubRouteMove::Serialize( edaBuffer &buf, bool pack ) { if(pack){ buf.Pack( &NUM_OPT_1, 1 ); buf.Pack( &NUM_OPT_2, 1 ); buf.Pack( &POS_OPT_1, 1 ); buf.Pack( &POS_OPT_2, 1 ); buf.Pack( &INC_DIST, 1 ); buf.Pack( &INC_WAIT_TIME, 1 ); buf.Pack( &INC_MOVE_TIME, 1 ); } else{ buf.UnPack( &NUM_OPT_1, 1 ); buf.UnPack( &NUM_OPT_2, 1 ); buf.UnPack( &POS_OPT_1, 1 ); buf.UnPack( &POS_OPT_2, 1 ); buf.UnPack( &INC_DIST, 1 ); buf.UnPack( &INC_WAIT_TIME, 1 ); buf.UnPack( &INC_MOVE_TIME, 1 ); } }
void edaSimpleMoveTabuList::Serialize(edaBuffer &buf, bool pack) { if (pack) { buf.Pack(&maxSize, 1); buf.Pack(¤tSize, 1); // Pack the list size unsigned int listSize = tabuList.size(); buf.Pack(&listSize, 1); std::list<edaMove *>::iterator moveIter; for (moveIter = tabuList.begin(); moveIter != tabuList.end(); moveIter++) { // Pack the elements of list (*moveIter)->doSerialize(buf, pack); } } else { // Clear old list content std::list<edaMove *>::iterator moveIter; for (moveIter = tabuList.begin(); moveIter != tabuList.end(); moveIter++) { if ((*moveIter) != NULL) { delete *moveIter; } } buf.UnPack(&maxSize, 1); buf.UnPack(¤tSize, 1); // Get the number of element unsigned int listSize; buf.UnPack(&listSize, 1); // UnPack the elements edaMove *tmpMove; for (unsigned int i = 0; i < listSize; i++) { tmpMove = (edaMove*)classGenerateFromBuffer(buf); tabuList.push_back(tmpMove); } } }
void schedSolution::serialize(edaBuffer& buf, bool pack) { unsigned int n = size(); unsigned int value; if (pack) { buf.pack(&n); for (unsigned int i = 0; i < n; i++) { value = at(i); buf.pack(&value); } buf.pack(&_fitness); } else { easer(); buf.unpack(&n); for (unsigned int i = 0; i < n; i++) { buf.unpack(&value); push_back(value); } buf.unpack(&_fitness); } }
void tspSolution::Serialize( edaBuffer &buf, bool pack ) { if (pack) { // Pack the Graph graph->doSerialize(buf, pack); // then pack the vector unsigned _size = this->size(); buf.Pack(&_size, 1); vector<unsigned int>::iterator iter; for (iter = this->begin(); iter != this->end(); iter++) { buf.Pack((unsigned int *) &(*iter), 1); } //Pack the Cost buf.Pack(&cost, 1); } else { easer(); // Unpack the Graph graph = (Graph*) classGenerateFromBuffer(buf); // then unpack the vector unsigned int _size; buf.UnPack(&_size, 1); this->resize(_size); for (unsigned int i = 0; i < _size; i++) { int atom; buf.UnPack((int *) &atom, 1); (*this)[i] = atom; } //UnPack the Cost buf.UnPack(&cost, 1); } }
void vrpContinue::Serialize(edaBuffer &buf, bool pack) { edaGenContinue::Serialize(buf, pack); if (pack) { buf.Pack(&maxNumGen, 1); buf.Pack(&numGen, 1); buf.Pack(&_prev, 1); buf.Pack(&_next, 1); buf.Pack(&_numRepeat, 1); buf.Pack(&_count, 1); buf.Pack(&_par_0, 1); buf.Pack(&_par_1, 1); } else { buf.UnPack(&maxNumGen, 1); buf.UnPack(&numGen, 1); buf.UnPack(&_prev, 1); buf.UnPack(&_next, 1); buf.UnPack(&_numRepeat, 1); buf.UnPack(&_count, 1); buf.UnPack(&_par_0, 1); buf.UnPack(&_par_1, 1); } }
void mtspSolution::serialize(edaBuffer& buf, bool pack) { if (pack) { buf.pack(&_size); buf.pack(_come, _size); buf.pack(_wait, _size); buf.pack(_late, _size); buf.pack(_route, _size); buf.pack(_move, _size); buf.pack(&_fitness); } else { easer(); buf.unpack(&_size); _come = new unsigned int[_size]; _wait = new unsigned int[_size]; _late = new unsigned int[_size]; _route = new unsigned int[_size]; _move = new unsigned int[_size]; buf.unpack(_come, _size); buf.unpack(_wait, _size); buf.unpack(_late, _size); buf.unpack(_route, _size); buf.unpack(_move, _size); buf.unpack(&_fitness); } }
void vrpInterchangeMove::Serialize( edaBuffer &buf, bool pack ) { if (pack){ buf.Pack( &ID_ROUTE_1, 1 ); buf.Pack( &ID_ROUTE_2, 1 ); buf.Pack( &ID_SUB_1, 1 ); buf.Pack( &ID_SUB_2, 1 ); buf.Pack( &NUM_OPT_1, 1 ); buf.Pack( &NUM_OPT_2, 1 ); buf.Pack( &POS_OPT_1, 1 ); buf.Pack( &POS_OPT_2, 1 ); buf.Pack( &INC_DIST, 1 ); buf.Pack( &INC_WAIT_TIME, 1 ); buf.Pack( &INC_MOVE_TIME, 1 ); } else { buf.UnPack( &ID_ROUTE_1, 1 ); buf.UnPack( &ID_ROUTE_2, 1 ); buf.UnPack( &ID_SUB_1, 1 ); buf.UnPack( &ID_SUB_2, 1 ); buf.UnPack( &NUM_OPT_1, 1 ); buf.UnPack( &NUM_OPT_2, 1 ); buf.UnPack( &POS_OPT_1, 1 ); buf.UnPack( &POS_OPT_2, 1 ); buf.UnPack( &INC_DIST, 1 ); buf.UnPack( &INC_WAIT_TIME, 1 ); buf.UnPack( &INC_MOVE_TIME, 1 ); } }
void airGenne::Serialize(edaBuffer& buf,bool pack) { if (pack) buf.Pack(&value, 1); else buf.UnPack(&value, 1); }