Remove unnecessary tests.
This commit is contained in:
parent
7baf7cb799
commit
3eba6b962c
4 changed files with 62 additions and 64 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
2006-12-02 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
||||||
|
|
||||||
|
* configure.in: Remove unnecessary tests.
|
||||||
|
|
||||||
2006-11-16 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
2006-11-16 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
||||||
|
|
||||||
* configure.in (AC_DEBUG): add test
|
* configure.in (AC_DEBUG): add test
|
||||||
|
|
|
||||||
|
|
@ -30,18 +30,12 @@ AC_CHECK_PROGS([DOXYGEN], [doxygen], [true])
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_LANG(C++)
|
AC_LANG(C++)
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(limits, [], AC_MSG_ERROR([Need limits C++ include.]))
|
|
||||||
AC_CHECK_HEADERS(sstream, [], AC_MSG_ERROR([Need sstream C++ include.]))
|
|
||||||
AC_CHECK_HEADERS(stdint.h, [], AC_MSG_WARN([Need C99 standard header.]))
|
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_CHECK_SIZEOF(unsigned long)
|
|
||||||
AC_CHECK_TYPES(uint32_t, [], AC_MSG_WARN([Need uint32_t from C99 standard.]))
|
AC_CHECK_TYPES(uint32_t, [], AC_MSG_WARN([Need uint32_t from C99 standard.]))
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries and library functions.
|
||||||
|
|
||||||
dnl Checks for library functions.
|
|
||||||
AC_CHECK_LIB(m, cos)
|
AC_CHECK_LIB(m, cos)
|
||||||
|
|
||||||
dnl user-switches
|
dnl user-switches
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: eodev-main@lists.sourceforge.net
|
||||||
Marc.Schoenauer@polytechnique.fr
|
old contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
CVS Info: $Date: 2003-02-27 19:26:43 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/contrib/MGE/VirusOp.h,v 1.3 2003-02-27 19:26:43 okoenig Exp $ $Author: okoenig $
|
Marc.Schoenauer@polytechnique.fr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef VirusOp_h
|
#ifndef VirusOp_h
|
||||||
|
|
@ -31,7 +31,7 @@ CVS Info: $Date: 2003-02-27 19:26:43 $ $Header: /home/nojhan/dev/eodev/eodev_cvs
|
||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
|
|
||||||
#include <utils/eoRNG.h>
|
#include <utils/eoRNG.h>
|
||||||
#include "../contrib/MGE/eoVirus.h"
|
#include "eoVirus.h"
|
||||||
|
|
||||||
/** VirusBitFlip --> changes 1 bit
|
/** VirusBitFlip --> changes 1 bit
|
||||||
*/
|
*/
|
||||||
|
|
@ -42,10 +42,10 @@ class VirusBitFlip: public eoMonOp<eoVirus<FitT> > {
|
||||||
/// The class name.
|
/// The class name.
|
||||||
virtual std::string className() const { return "VirusBitFlip"; };
|
virtual std::string className() const { return "VirusBitFlip"; };
|
||||||
|
|
||||||
/**
|
/** Change one bit.
|
||||||
* Change one bit.
|
|
||||||
* @param chrom The cromosome which one bit is going to be changed.
|
@param chrom The cromosome which one bit is going to be changed.
|
||||||
*/
|
*/
|
||||||
bool operator()(eoVirus<FitT>& _chrom) {
|
bool operator()(eoVirus<FitT>& _chrom) {
|
||||||
unsigned i = eo::rng.random(_chrom.size());
|
unsigned i = eo::rng.random(_chrom.size());
|
||||||
_chrom.virusBitSet(i, _chrom.virusBit(i) ? false : true );
|
_chrom.virusBitSet(i, _chrom.virusBit(i) ? false : true );
|
||||||
|
|
@ -53,71 +53,72 @@ class VirusBitFlip: public eoMonOp<eoVirus<FitT> > {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<class FitT>
|
template<class FitT>
|
||||||
class VirusMutation: public eoMonOp<eoVirus<FitT> > {
|
class VirusMutation: public eoMonOp<eoVirus<FitT> > {
|
||||||
public:
|
public:
|
||||||
/// The class name.
|
/// The class name.
|
||||||
virtual std::string className() const { return "VirusMutation"; };
|
virtual std::string className() const { return "VirusMutation"; };
|
||||||
|
|
||||||
/**
|
/** Change one bit.
|
||||||
* Change one bit.
|
|
||||||
* @param chrom The cromosome which one bit is going to be changed.
|
@param chrom The cromosome which one bit is going to be changed.
|
||||||
*/
|
*/
|
||||||
bool operator()(eoVirus<FitT>& _chrom) {
|
bool operator()(eoVirus<FitT>& _chrom) {
|
||||||
// Search for virus bits
|
// Search for virus bits
|
||||||
std::vector<unsigned> bitsSet;
|
std::vector<unsigned> bitsSet;
|
||||||
for ( unsigned i = 0; i < _chrom.size(); i ++ ) {
|
for ( unsigned i = 0; i < _chrom.size(); i ++ ) {
|
||||||
if ( _chrom.virusBit(i) ) {
|
if ( _chrom.virusBit(i) ) {
|
||||||
bitsSet.push_back( i );
|
bitsSet.push_back( i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !bitsSet.size() ) {
|
if ( !bitsSet.size() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unsigned flipSite = eo::rng.random(bitsSet.size());
|
unsigned flipSite = eo::rng.random(bitsSet.size());
|
||||||
unsigned flipValue = bitsSet[ flipSite ];
|
unsigned flipValue = bitsSet[ flipSite ];
|
||||||
_chrom[flipValue] = _chrom[flipValue] ? false : true;
|
_chrom[flipValue] = _chrom[flipValue] ? false : true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Works for 1-bit virus; shifts the one to the right or left
|
/// Works for 1-bit virus; shifts the one to the right or left
|
||||||
template<class FitT>
|
template<class FitT>
|
||||||
class VirusShiftMutation: public eoMonOp<eoVirus<FitT> > {
|
class VirusShiftMutation: public eoMonOp<eoVirus<FitT> >
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
/// Ctor
|
/// Ctor
|
||||||
VirusShiftMutation( ) {};
|
VirusShiftMutation( ) {};
|
||||||
|
|
||||||
/// The class name.
|
/// The class name.
|
||||||
virtual std::string className() const { return "VirusShiftMutation"; };
|
virtual std::string className() const { return "VirusShiftMutation"; };
|
||||||
|
|
||||||
/**
|
/** Change one bit.
|
||||||
* Change one bit.
|
|
||||||
* @param chrom The cromosome which one bit is going to be changed.
|
|
||||||
*/
|
|
||||||
bool operator()(eoVirus<FitT>& _chrom) {
|
|
||||||
// Search for virus bits
|
|
||||||
eoBooleanGenerator gen;
|
|
||||||
for ( unsigned i = 0; i < _chrom.size(); i ++ ) {
|
|
||||||
if ( _chrom.virusBit(i) ) {
|
|
||||||
if ( gen() ) {
|
|
||||||
if ( i + 1 < _chrom.size() ) {
|
|
||||||
_chrom.virusBitSet(i+1,true);
|
|
||||||
_chrom.virusBitSet(i, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( i - 1 > 0 ) {
|
|
||||||
_chrom.virusBitSet(i-1,true);
|
|
||||||
_chrom.virusBitSet(i, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
@param chrom The cromosome which one bit is going to be changed.
|
||||||
|
*/
|
||||||
|
bool operator()(eoVirus<FitT>& _chrom) {
|
||||||
|
// Search for virus bits
|
||||||
|
eoBooleanGenerator gen;
|
||||||
|
for ( unsigned i = 0; i < _chrom.size(); i ++ ) {
|
||||||
|
if ( _chrom.virusBit(i) ) {
|
||||||
|
if ( gen() ) {
|
||||||
|
if ( i + 1 < _chrom.size() ) {
|
||||||
|
_chrom.virusBitSet(i+1,true);
|
||||||
|
_chrom.virusBitSet(i, false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( i - 1 > 0 ) {
|
||||||
|
_chrom.virusBitSet(i-1,true);
|
||||||
|
_chrom.virusBitSet(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
CXX = g++
|
CXX = g++
|
||||||
CXXFLAGS = -DHAVE_SSTREAM
|
|
||||||
CPPFLAGS = -Wall -O2 #-g #-O2
|
CPPFLAGS = -Wall -O2 #-g #-O2
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
COMPILE = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
|
COMPILE = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
|
||||||
|
|
|
||||||
Reference in a new issue