#ifndef __moRealNeighbor_h__ #define __moRealNeighbor_h__ #include #include #include //! A neighbor as produced by a moRealNeighborhood /*! * In a real neighborhood, the move is just a translation vector, of the same type than a solution. */ template class moRealNeighbor : public moNeighbor { protected: //! The move to be applied EOT _translation; edoBounder * _bounder; public: moRealNeighbor() : _bounder( NULL ) { } //! Returns the solution attached to this neighbor EOT translation() { return _translation; } //! Set the translation void translation( EOT translation ) { _translation = translation; } void bounder( edoBounder * bounder ) { _bounder = bounder; } /** * Assignment operator * @param _neighbor the neighbor to assign * @return a neighbor equal to the other */ virtual moNeighbor& operator=(const moNeighbor& _neighbor) { fitness( _neighbor.fitness() ); return (*this); } /*! * Move a solution to the solution of this neighbor * @param _solution the related solution */ virtual void move(EOT & _solution) { assert( _solution.size() == _translation.size() ); for( unsigned int i=0, size= _solution.size(); i& _neighbor) { return _neighbor.translation() == _translation; } /** * Return the class Name * @return the class name as a std::string */ virtual std::string className() const { return "moRealNeighbor"; } }; #endif // __moRealNeighbor_h__