Merge branch 'master' of ssh://localhost:8479/gitroot/eodev/eodev
This commit is contained in:
commit
da5b29146b
4 changed files with 131 additions and 13 deletions
|
|
@ -49,6 +49,10 @@ public:
|
||||||
assert( this->max().size() > 0 );
|
assert( this->max().size() > 0 );
|
||||||
|
|
||||||
assert( sol.size() > 0);
|
assert( sol.size() > 0);
|
||||||
|
assert( sol.size() == this->min().size() );
|
||||||
|
|
||||||
|
eo::log << eo::debug << "BounderUniform: from sol = " << sol;
|
||||||
|
eo::log.flush();
|
||||||
|
|
||||||
unsigned int size = sol.size();
|
unsigned int size = sol.size();
|
||||||
for (unsigned int d = 0; d < size; ++d) {
|
for (unsigned int d = 0; d < size; ++d) {
|
||||||
|
|
@ -58,6 +62,8 @@ public:
|
||||||
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
|
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
|
||||||
}
|
}
|
||||||
} // for d in size
|
} // for d in size
|
||||||
|
|
||||||
|
eo::log << eo::debug << "\tto sol = " << sol << std::endl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,15 +91,27 @@ public:
|
||||||
//! Repair a solution by calling several repair operator on subset of indexes
|
//! Repair a solution by calling several repair operator on subset of indexes
|
||||||
virtual void operator()( EOT& sol )
|
virtual void operator()( EOT& sol )
|
||||||
{
|
{
|
||||||
// ipair is an iterator that points on a pair
|
// std::cout << "in dispatcher, sol = " << sol << std::endl;
|
||||||
|
|
||||||
|
// ipair is an iterator that points on a pair of <indexes,repairer>
|
||||||
for( typename edoRepairerDispatcher<EOT>::iterator ipair = this->begin(); ipair != this->end(); ++ipair ) {
|
for( typename edoRepairerDispatcher<EOT>::iterator ipair = this->begin(); ipair != this->end(); ++ipair ) {
|
||||||
|
|
||||||
|
assert( ipair->first.size() <= sol.size() ); // assert there is less indexes than items in the whole solution
|
||||||
|
|
||||||
// a partial copy of the sol
|
// a partial copy of the sol
|
||||||
EOT partsol;
|
EOT partsol;
|
||||||
|
|
||||||
|
// std::cout << "\tusing indexes = ";
|
||||||
// j is an iterator that points on an uint
|
// j is an iterator that points on an uint
|
||||||
for( std::vector< unsigned int >::iterator j = ipair->first.begin(); j != ipair->first.end(); ++j ) {
|
for( std::vector< unsigned int >::iterator j = ipair->first.begin(); j != ipair->first.end(); ++j ) {
|
||||||
|
|
||||||
|
// std::cout << *j << " ";
|
||||||
|
// std::cout.flush();
|
||||||
|
|
||||||
partsol.push_back( sol.at(*j) );
|
partsol.push_back( sol.at(*j) );
|
||||||
} // for j
|
} // for j
|
||||||
|
// std::cout << std::endl;
|
||||||
|
// std::cout << "\tpartial sol = " << partsol << std::endl;
|
||||||
|
|
||||||
assert( partsol.size() > 0 );
|
assert( partsol.size() > 0 );
|
||||||
|
|
||||||
|
|
|
||||||
100
eo/cmake/modules/FindEO.cmake
Normal file
100
eo/cmake/modules/FindEO.cmake
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
# File: FindEO.cmake
|
||||||
|
# CMAKE commands to actually use the EO library
|
||||||
|
# Version: 0.0.1
|
||||||
|
#
|
||||||
|
# The following variables are filled out:
|
||||||
|
# - EO_INCLUDE_DIR
|
||||||
|
# - EO_LIBRARY_DIR
|
||||||
|
# - EO_LIBRARIES
|
||||||
|
# - EO_FOUND
|
||||||
|
#
|
||||||
|
# Here are the components:
|
||||||
|
# - PyEO
|
||||||
|
# - es
|
||||||
|
# - ga
|
||||||
|
# - cma
|
||||||
|
#
|
||||||
|
# You can use FIND_PACKAGE( EO COMPONENTS ... ) to enable one or several components.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Default enabled components
|
||||||
|
SET(EO_LIBRARIES_TO_FIND eo eoutils)
|
||||||
|
|
||||||
|
# Use FIND_PACKAGE( EO COMPONENTS ... ) to enable modules
|
||||||
|
IF(EO_FIND_COMPONENTS)
|
||||||
|
FOREACH(component ${EO_FIND_COMPONENTS})
|
||||||
|
STRING(TOUPPER ${component} _COMPONENT)
|
||||||
|
SET(EO_USE_${_COMPONENT} 1)
|
||||||
|
ENDFOREACH(component)
|
||||||
|
|
||||||
|
# To make sure we don't use PyEO, ES, GA, CMA when not in COMPONENTS
|
||||||
|
IF(NOT EO_USE_PYEO)
|
||||||
|
SET(EO_DONT_USE_PYEO 1)
|
||||||
|
ELSE(NOT EO_USE_PYEO)
|
||||||
|
SET(EO_LIBRARIES_TO_FIND ${EO_LIBRARIES_TO_FIND} PyEO)
|
||||||
|
ENDIF(NOT EO_USE_PYEO)
|
||||||
|
|
||||||
|
IF(NOT EO_USE_ES)
|
||||||
|
SET(EO_DONT_USE_ES 1)
|
||||||
|
ELSE(NOT EO_USE_ES)
|
||||||
|
SET(EO_LIBRARIES_TO_FIND ${EO_LIBRARIES_TO_FIND} es)
|
||||||
|
ENDIF(NOT EO_USE_ES)
|
||||||
|
|
||||||
|
IF(NOT EO_USE_GA)
|
||||||
|
SET(EO_DONT_USE_GA 1)
|
||||||
|
ELSE(NOT EO_USE_GA)
|
||||||
|
SET(EO_LIBRARIES_TO_FIND ${EO_LIBRARIES_TO_FIND} ga)
|
||||||
|
ENDIF(NOT EO_USE_GA)
|
||||||
|
|
||||||
|
IF(NOT EO_USE_CMA)
|
||||||
|
SET(EO_DONT_USE_CMA 1)
|
||||||
|
ELSE(NOT EO_USE_CMA)
|
||||||
|
SET(EO_LIBRARIES_TO_FIND ${EO_LIBRARIES_TO_FIND} cma)
|
||||||
|
ENDIF(NOT EO_USE_CMA)
|
||||||
|
ENDIF(EO_FIND_COMPONENTS)
|
||||||
|
|
||||||
|
IF(NOT EO_INCLUDE_DIR)
|
||||||
|
FIND_PATH(
|
||||||
|
EO_INCLUDE_DIR
|
||||||
|
EO.h
|
||||||
|
PATHS
|
||||||
|
/usr/include/eo
|
||||||
|
/usr/local/include/eo
|
||||||
|
)
|
||||||
|
ENDIF(NOT EO_INCLUDE_DIR)
|
||||||
|
|
||||||
|
IF(NOT EO_LIBRARY_DIR)
|
||||||
|
FIND_PATH(
|
||||||
|
EO_LIBRARY_DIR
|
||||||
|
libeo.a
|
||||||
|
PATHS
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
)
|
||||||
|
ENDIF(NOT EO_LIBRARY_DIR)
|
||||||
|
|
||||||
|
IF(NOT EO_LIBRARIES)
|
||||||
|
SET(EO_LIBRARIES)
|
||||||
|
FOREACH(component ${EO_LIBRARIES_TO_FIND})
|
||||||
|
FIND_LIBRARY(
|
||||||
|
EO_${component}_LIBRARY
|
||||||
|
NAMES ${component}
|
||||||
|
PATHS
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
)
|
||||||
|
IF(EO_${component}_LIBRARY)
|
||||||
|
SET(EO_LIBRARIES ${EO_LIBRARIES} ${EO_${component}_LIBRARY})
|
||||||
|
ELSE(EO_${component}_LIBRARY)
|
||||||
|
MESSAGE(FATAL_ERROR "${component} component not found.")
|
||||||
|
ENDIF(EO_${component}_LIBRARY)
|
||||||
|
ENDFOREACH(component)
|
||||||
|
ENDIF(NOT EO_LIBRARIES)
|
||||||
|
|
||||||
|
IF(EO_INCLUDE_DIR AND EO_LIBRARY_DIR AND EO_LIBRARIES)
|
||||||
|
SET(EO_FOUND 1)
|
||||||
|
MARK_AS_ADVANCED(EO_FOUND)
|
||||||
|
MARK_AS_ADVANCED(EO_INCLUDE_DIR)
|
||||||
|
MARK_AS_ADVANCED(EO_LIBRARY_DIR)
|
||||||
|
MARK_AS_ADVANCED(EO_LIBRARIES)
|
||||||
|
ENDIF(EO_INCLUDE_DIR AND EO_LIBRARY_DIR AND EO_LIBRARIES)
|
||||||
Reference in a new issue