Encore du nettoyage
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1814 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
3d8057ac4d
commit
02e5cfb6c0
66 changed files with 987 additions and 1785 deletions
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moAlwaysAcceptCrit] => START" << std::endl;
|
std::cout << "[t-moAlwaysAcceptCrit] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moAutocorrelationSampling] => START" << std::endl;
|
std::cout << "[t-moAutocorrelationSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <acceptCrit/moBetterAcceptCrit.h>
|
#include <acceptCrit/moBetterAcceptCrit.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moBetterAcceptCrit] => START" << std::endl;
|
std::cout << "[t-moBetterAcceptCrit] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moCombinedContinuator] => START" << std::endl;
|
std::cout << "[t-moCombinedContinuator] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <memory/moCountMoveMemory.h>
|
#include <memory/moCountMoveMemory.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moCountMoveMemory] => START" << std::endl;
|
std::cout << "[t-moCountMoveMemory] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
#include <continuator/moCounterStat.h>
|
#include <continuator/moCounterStat.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moCounterStat] => START" << std::endl;
|
std::cout << "[t-moCounterStat] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl;
|
std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <eval/moDummyEval.h>
|
#include <eval/moDummyEval.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moDummyEval] => START" << std::endl;
|
std::cout << "[t-moDummyEval] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <explorer/moDummyExplorer.h>
|
#include <explorer/moDummyExplorer.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moDummyExplorer] => START" << std::endl;
|
std::cout << "[t-moDummyExplorer] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moDummyLS] => START" << std::endl;
|
std::cout << "[t-moDummyLS] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <neighborhood/moDummyNeighbor.h>
|
#include <neighborhood/moDummyNeighbor.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moDummyNeighbor] => START" << std::endl;
|
std::cout << "[t-moDummyNeighbor] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <neighborhood/moDummyNeighborhood.h>
|
#include <neighborhood/moDummyNeighborhood.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moDummyNeighborhood] => START" << std::endl;
|
std::cout << "[t-moDummyNeighborhood] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <eval/moEvalCounter.h>
|
#include <eval/moEvalCounter.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moEvalCounter] => START" << std::endl;
|
std::cout << "[t-moEvalCounter] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <utils/eoDistance.h>
|
#include <utils/eoDistance.h>
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moFDCsampling] => START" << std::endl;
|
std::cout << "[t-moFDCsampling] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moTrueContinuator.h>
|
#include <continuator/moTrueContinuator.h>
|
||||||
#include <comparator/moSolNeighborComparator.h>
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moFirstImprHC] => START" << std::endl;
|
std::cout << "[t-moFirstImprHC] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moFitContinuator.h>
|
#include <continuator/moFitContinuator.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moFitContinuator] => START" << std::endl;
|
std::cout << "[t-moFitContinuator] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moFitnessCloudSampling] => START" << std::endl;
|
std::cout << "[t-moFitnessCloudSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moForwardVariableNeighborhood] => START" << std::endl;
|
std::cout << "[t-moForwardVariableNeighborhood] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moFullEvalContinuator] => START" << std::endl;
|
std::cout << "[t-moFullEvalContinuator] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moHillClimberSampling] => START" << std::endl;
|
std::cout << "[t-moHillClimberSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,14 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <memory/moSolVectorTabuList.h>
|
#include <memory/moSolVectorTabuList.h>
|
||||||
#include <neighborhood/moDummyNeighbor.h>
|
#include <neighborhood/moDummyNeighbor.h>
|
||||||
|
|
||||||
class dummyMonOp: public eoMonOp<bitVector>{
|
class dummyMonOp: public eoMonOp<bitVector> {
|
||||||
public:
|
public:
|
||||||
bool operator()(bitVector&){return false;}
|
bool operator()(bitVector&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moILS] => START" << std::endl;
|
std::cout << "[t-moILS] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,16 +42,16 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
||||||
|
|
||||||
|
|
||||||
class dummyMonOp: public eoMonOp<bitVector>{
|
class dummyMonOp: public eoMonOp<bitVector> {
|
||||||
|
|
||||||
bool operator()(bitVector& _sol){
|
bool operator()(bitVector& _sol) {
|
||||||
_sol[0]=!_sol[0];
|
_sol[0]=!_sol[0];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moILSexplorer] => START" << std::endl;
|
std::cout << "[t-moILSexplorer] => START" << std::endl;
|
||||||
bitNeighborhood nh(4);
|
bitNeighborhood nh(4);
|
||||||
|
|
@ -86,7 +86,7 @@ int main(){
|
||||||
test(sol);
|
test(sol);
|
||||||
test.move(sol);
|
test.move(sol);
|
||||||
|
|
||||||
for(unsigned int i=0; i<sol.size(); i++)
|
for (unsigned int i=0; i<sol.size(); i++)
|
||||||
assert(!sol[i]);
|
assert(!sol[i]);
|
||||||
assert(sol.fitness()==0);
|
assert(sol.fitness()==0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moIterContinuator.h>
|
#include <continuator/moIterContinuator.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moIterContinuator] => START" << std::endl;
|
std::cout << "[t-moIterContinuator] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moLocalSearch] => START" << std::endl;
|
std::cout << "[t-moLocalSearch] => START" << std::endl;
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ int main(){
|
||||||
test(sol);
|
test(sol);
|
||||||
|
|
||||||
assert(sol.fitness()==0);
|
assert(sol.fitness()==0);
|
||||||
for(unsigned int i=0; i<sol.size(); i++)
|
for (unsigned int i=0; i<sol.size(); i++)
|
||||||
assert(!sol[i]);
|
assert(!sol[i]);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moLocalSearchInit] => START" << std::endl;
|
std::cout << "[t-moLocalSearchInit] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <comparator/moSolNeighborComparator.h>
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
#include <comparator/moNeighborComparator.h>
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moMetropolisHasting] => START" << std::endl;
|
std::cout << "[t-moMetropolisHasting] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
#include <continuator/moMinusOneCounterStat.h>
|
#include <continuator/moMinusOneCounterStat.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moMinusOneCounterStat] => START" << std::endl;
|
std::cout << "[t-moMinusOneCounterStat] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,16 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
|
||||||
class dummyMonOp: public eoMonOp<bitVector>{
|
class dummyMonOp: public eoMonOp<bitVector> {
|
||||||
|
|
||||||
bool operator()(bitVector& _sol){
|
bool operator()(bitVector& _sol) {
|
||||||
_sol[0]=!_sol[0];
|
_sol[0]=!_sol[0];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moMonOpDiversification] => START" << std::endl;
|
std::cout << "[t-moMonOpDiversification] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,16 +37,16 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
|
||||||
class dummyMonOp: public eoMonOp<bitVector>{
|
class dummyMonOp: public eoMonOp<bitVector> {
|
||||||
|
|
||||||
bool operator()(bitVector& _sol){
|
bool operator()(bitVector& _sol) {
|
||||||
_sol[0]=!_sol[0];
|
_sol[0]=!_sol[0];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moMonOpPerturb] => START" << std::endl;
|
std::cout << "[t-moMonOpPerturb] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moNeighborBestStat.h>
|
#include <continuator/moNeighborBestStat.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moNeighborBestStat] => START" << std::endl;
|
std::cout << "[t-moNeighborBestStat] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moNeighborEvalContinuator.h>
|
#include <continuator/moNeighborEvalContinuator.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moNeighborEvalContinuator] => START" << std::endl;
|
std::cout << "[t-moNeighborEvalContinuator] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moNeighborFitnessStat.h>
|
#include <continuator/moNeighborFitnessStat.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moNeighborFitnessStat] => START" << std::endl;
|
std::cout << "[t-moNeighborFitnessStat] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moNeighborVectorTabuList] => START" << std::endl;
|
std::cout << "[t-moNeighborVectorTabuList] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
typedef moOrderNeighborhood<bitNeighbor> Neighborhood;
|
typedef moOrderNeighborhood<bitNeighbor> Neighborhood;
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moNeighborhoodPerturb] => START" << std::endl;
|
std::cout << "[t-moNeighborhoodPerturb] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <comparator/moNeighborComparator.h>
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl;
|
std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <comparator/moSolNeighborComparator.h>
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
#include <comparator/moNeighborComparator.h>
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moNeutralHC] => START" << std::endl;
|
std::cout << "[t-moNeutralHC] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <utils/eoDistance.h>
|
#include <utils/eoDistance.h>
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moNeutralWalkSampling] => START" << std::endl;
|
std::cout << "[t-moNeutralWalkSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moTrueContinuator.h>
|
#include <continuator/moTrueContinuator.h>
|
||||||
#include <comparator/moSolNeighborComparator.h>
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moRandomBestHC] => START" << std::endl;
|
std::cout << "[t-moRandomBestHC] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moTrueContinuator.h>
|
#include <continuator/moTrueContinuator.h>
|
||||||
#include <comparator/moSolNeighborComparator.h>
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moRandomNeutralWalk] => START" << std::endl;
|
std::cout << "[t-moRandomNeutralWalk] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
#include <continuator/moTrueContinuator.h>
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moRandomSearch] => START" << std::endl;
|
std::cout << "[t-moRandomSearch] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
#include <eval/oneMaxEval.h>
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moRandomSearchExplorer] => START" << std::endl;
|
std::cout << "[t-moRandomSearchExplorer] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <comparator/moSolNeighborComparator.h>
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
#include <comparator/moNeighborComparator.h>
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moRandomWalk] => START" << std::endl;
|
std::cout << "[t-moRandomWalk] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ typedef eoInt<unsigned int> QUEEN;
|
||||||
class dummyInit : public eoInit<QUEEN>
|
class dummyInit : public eoInit<QUEEN>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
dummyInit(unsigned int _size):size(_size){}
|
dummyInit(unsigned int _size):size(_size) {}
|
||||||
|
|
||||||
void operator()(QUEEN& _sol){
|
void operator()(QUEEN& _sol) {
|
||||||
_sol.resize(0);
|
_sol.resize(0);
|
||||||
for(unsigned int i=0; i<size; i++)
|
for (unsigned int i=0; i<size; i++)
|
||||||
_sol.push_back(i);
|
_sol.push_back(i);
|
||||||
_sol.invalidate();
|
_sol.invalidate();
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +58,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moRestartPerturb] => START" << std::endl;
|
std::cout << "[t-moRestartPerturb] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moTrueContinuator.h>
|
#include <continuator/moTrueContinuator.h>
|
||||||
#include <comparator/moSolNeighborComparator.h>
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moSA] => START" << std::endl;
|
std::cout << "[t-moSA] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <explorer/moSAexplorer.h>
|
#include <explorer/moSAexplorer.h>
|
||||||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moSAexplorer] => START" << std::endl;
|
std::cout << "[t-moSAexplorer] => START" << std::endl;
|
||||||
|
|
||||||
|
|
@ -66,11 +66,11 @@ int main(){
|
||||||
assert(sol.fitness()==3);
|
assert(sol.fitness()==3);
|
||||||
unsigned int ok=0;
|
unsigned int ok=0;
|
||||||
unsigned int ko=0;
|
unsigned int ko=0;
|
||||||
for(unsigned int i=0; i<1000; i++){
|
for (unsigned int i=0; i<1000; i++) {
|
||||||
test2(sol);
|
test2(sol);
|
||||||
if(test2.isContinue(sol))
|
if (test2.isContinue(sol))
|
||||||
test2.updateParam(sol);
|
test2.updateParam(sol);
|
||||||
if(test2.accept(sol))
|
if (test2.accept(sol))
|
||||||
ok++;
|
ok++;
|
||||||
else
|
else
|
||||||
ko++;
|
ko++;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moCounterStat.h>
|
#include <continuator/moCounterStat.h>
|
||||||
#include <continuator/moIterContinuator.h>
|
#include <continuator/moIterContinuator.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moSampling] => START" << std::endl;
|
std::cout << "[t-moSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
|
@ -63,10 +63,10 @@ int main(){
|
||||||
res = test.getValues(1);
|
res = test.getValues(1);
|
||||||
res2= test.getSolutions(0);
|
res2= test.getSolutions(0);
|
||||||
|
|
||||||
for(unsigned int i=0; i<res2.size(); i++)
|
for (unsigned int i=0; i<res2.size(); i++)
|
||||||
assert(res2[i].fitness()==4-i);
|
assert(res2[i].fitness()==4-i);
|
||||||
|
|
||||||
for(unsigned int i=0; i<res.size(); i++)
|
for (unsigned int i=0; i<res.size(); i++)
|
||||||
assert(res[i]==i);
|
assert(res[i]==i);
|
||||||
|
|
||||||
test.fileExport("outputTestSampling1");
|
test.fileExport("outputTestSampling1");
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moSimpleCoolingSchedule] => START" << std::endl;
|
std::cout << "[t-moSimpleCoolingSchedule] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <comparator/moSolNeighborComparator.h>
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moSimpleHC] => START" << std::endl;
|
std::cout << "[t-moSimpleHC] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <comparator/moSolComparator.h>
|
#include <comparator/moSolComparator.h>
|
||||||
#include <ga/eoBit.h>
|
#include <ga/eoBit.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moSolComparator] => START" << std::endl;
|
std::cout << "[t-moSolComparator] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
#include <perturb/moSolInit.h>
|
#include <perturb/moSolInit.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moSolInit] => START" << std::endl;
|
std::cout << "[t-moSolInit] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
#include <utils/eoDistance.h>
|
#include <utils/eoDistance.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moStatistics] => START" << std::endl;
|
std::cout << "[t-moStatistics] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <comparator/moNeighborComparator.h>
|
#include <comparator/moNeighborComparator.h>
|
||||||
#include <memory/moSolVectorTabuList.h>
|
#include <memory/moSolVectorTabuList.h>
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moTS] => START" << std::endl;
|
std::cout << "[t-moTS] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ void wait ( int seconds )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moTimeContinuator] => START" << std::endl;
|
std::cout << "[t-moTimeContinuator] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <continuator/moVectorMonitor.h>
|
#include <continuator/moVectorMonitor.h>
|
||||||
#include "moTestClass.h"
|
#include "moTestClass.h"
|
||||||
|
|
||||||
int main(){
|
int main() {
|
||||||
|
|
||||||
std::cout << "[t-moVectorMonitor] => START" << std::endl;
|
std::cout << "[t-moVectorMonitor] => START" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ using namespace std;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// fitness function
|
// fitness function
|
||||||
#include "../oneMax/src/funcRoyalRoad.h"
|
#include <eval/royalRoadEval.h>
|
||||||
#include <eoInt.h>
|
#include <eoInt.h>
|
||||||
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
||||||
#include <problems/bitString/moBitNeighbor.h>
|
#include <problems/bitString/moBitNeighbor.h>
|
||||||
|
|
@ -120,7 +120,7 @@ void main_function(int argc, char **argv)
|
||||||
*
|
*
|
||||||
* ========================================================= */
|
* ========================================================= */
|
||||||
|
|
||||||
FuncRoyalRoad<Indi> eval(vecSize / blockSize, blockSize);
|
RoyalRoadEval<Indi> eval(blockSize);
|
||||||
|
|
||||||
|
|
||||||
/* =========================================================
|
/* =========================================================
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
ADD_SUBDIRECTORY(application)
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src
|
|
||||||
${MO_SRC_DIR}/src
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../src)
|
|
||||||
|
|
||||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(testSimpleHC testSimpleHC.cpp)
|
|
||||||
ADD_EXECUTABLE(testFirstImpr testFirstImpr.cpp)
|
|
||||||
ADD_EXECUTABLE(testRandomWalk testRandomWalk.cpp)
|
|
||||||
ADD_EXECUTABLE(testRandomBestHC testRandomBestHC.cpp)
|
|
||||||
ADD_EXECUTABLE(testHCneutral testHCneutral.cpp)
|
|
||||||
ADD_EXECUTABLE(testMetropolisHasting testMetropolisHasting.cpp)
|
|
||||||
#ADD_EXECUTABLE(testWithMove testWithMove.cpp)
|
|
||||||
ADD_EXECUTABLE(testSimpleTS testSimpleTS.cpp)
|
|
||||||
ADD_EXECUTABLE(testRandomNeutralWalk testRandomNeutralWalk.cpp)
|
|
||||||
ADD_EXECUTABLE(testILS testILS.cpp)
|
|
||||||
ADD_EXECUTABLE(testSimulatedAnnealing testSimulatedAnnealing.cpp)
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(testSimpleHC eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testFirstImpr eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testRandomWalk eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testRandomBestHC eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testHCneutral eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testMetropolisHasting eoutils ga eo)
|
|
||||||
#TARGET_LINK_LIBRARIES(testWithMove eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testSimpleTS eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testRandomNeutralWalk eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testILS eoutils ga eo)
|
|
||||||
TARGET_LINK_LIBRARIES(testSimulatedAnnealing eoutils ga eo)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,214 +0,0 @@
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/** testSimpleHC.cpp
|
|
||||||
*
|
|
||||||
* SV - 12/01/10
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// standard includes
|
|
||||||
#define HAVE_SSTREAM
|
|
||||||
|
|
||||||
#include <stdexcept> // runtime_error
|
|
||||||
#include <iostream> // cout
|
|
||||||
#include <sstream> // ostrstream, istrstream
|
|
||||||
#include <fstream>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
// the general include for eo
|
|
||||||
#include <eo>
|
|
||||||
#include "ga.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// fitness function
|
|
||||||
#include <funcOneMax.h>
|
|
||||||
|
|
||||||
//#include <eoInt.h>
|
|
||||||
//#include <moEmptyNeighbor.h>
|
|
||||||
|
|
||||||
#include <continuator/moTrueContinuator.h>
|
|
||||||
|
|
||||||
// local search algorithm
|
|
||||||
#include <algo/moLocalSearch.h>
|
|
||||||
|
|
||||||
// the simple HC explorer
|
|
||||||
#include <explorer/moSimpleHCexplorer.h>
|
|
||||||
|
|
||||||
// explore the neighborhood of a bit string in order
|
|
||||||
#include <neighborhood/moMoveNeighborhood.h>
|
|
||||||
|
|
||||||
//#include <moFullEvalBitNeighbor.h>
|
|
||||||
|
|
||||||
#include <neighborhood/moMoveNeighbor.h>
|
|
||||||
|
|
||||||
#include <bitMove.h>
|
|
||||||
#include <bitMove_init.h>
|
|
||||||
#include <bitMoveIncrEval.h>
|
|
||||||
#include <bitMove_next.h>
|
|
||||||
|
|
||||||
// REPRESENTATION
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// define your individuals
|
|
||||||
typedef eoBit<unsigned> Indi;
|
|
||||||
//typedef OneMaxBitNeighbor<unsigned> Neighbor ; // incremental evaluation
|
|
||||||
typedef moMoveNeighbor<BitMove<Indi>, unsigned> Neighbor ; // full evaluation
|
|
||||||
typedef moMoveNeighborhood<BitMove<Indi>, unsigned> Neighborhood ;
|
|
||||||
|
|
||||||
// GENERAL
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void main_function(int argc, char **argv)
|
|
||||||
{
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* Parameters
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
// First define a parser from the command-line arguments
|
|
||||||
eoParser parser(argc, argv);
|
|
||||||
|
|
||||||
// For each parameter, define Parameter, read it through the parser,
|
|
||||||
// and assign the value to the variable
|
|
||||||
|
|
||||||
eoValueParam<uint32_t> seedParam(time(0), "seed", "Random number seed", 'S');
|
|
||||||
parser.processParam( seedParam );
|
|
||||||
unsigned seed = seedParam.value();
|
|
||||||
|
|
||||||
// description of genotype
|
|
||||||
eoValueParam<unsigned int> vecSizeParam(8, "vecSize", "Genotype size", 'V');
|
|
||||||
parser.processParam( vecSizeParam, "Representation" );
|
|
||||||
unsigned vecSize = vecSizeParam.value();
|
|
||||||
|
|
||||||
string fileOut("out.dat");
|
|
||||||
eoValueParam<string> fileStatParam(fileOut.c_str(), "out", "A file to export results", 'o');
|
|
||||||
parser.processParam( fileStatParam, "Persistence" );
|
|
||||||
fileOut = fileStatParam.value();
|
|
||||||
|
|
||||||
// the name of the "status" file where all actual parameter values will be saved
|
|
||||||
string str_status = parser.ProgramName() + ".status"; // default value
|
|
||||||
eoValueParam<string> statusParam(str_status.c_str(), "status", "Status file");
|
|
||||||
parser.processParam( statusParam, "Persistence" );
|
|
||||||
|
|
||||||
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
|
|
||||||
// i.e. in case you need parameters somewhere else, postpone these
|
|
||||||
if (parser.userNeedsHelp())
|
|
||||||
{
|
|
||||||
parser.printHelp(cout);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (statusParam.value() != "")
|
|
||||||
{
|
|
||||||
ofstream os(statusParam.value().c_str());
|
|
||||||
os << parser; // and you can use that file as parameter file
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* Random seed
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
//reproducible random seed: if you don't change SEED above,
|
|
||||||
// you'll aways get the same result, NOT a random run
|
|
||||||
rng.reseed(seed);
|
|
||||||
|
|
||||||
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* Eval fitness function
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
FuncOneMax<Indi> eval(vecSize);
|
|
||||||
|
|
||||||
OneMaxIncrEval<Indi> incrEval;
|
|
||||||
Neighbor::setIncrEval(incrEval);
|
|
||||||
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* Initilisation of the solution
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
// a Indi random initializer
|
|
||||||
eoUniformGenerator<bool> uGen;
|
|
||||||
eoInitFixedLength<Indi> random(vecSize, uGen);
|
|
||||||
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* evaluation of a neighbor solution
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
// no need if incremental evaluation with OneMaxBitNeighbor
|
|
||||||
// Neighbor::setFullEvalFunc(eval);
|
|
||||||
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* the neighborhood of a solution
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
BitMove_init<Indi> init;
|
|
||||||
BitMove_next<Indi> next;
|
|
||||||
|
|
||||||
|
|
||||||
Neighborhood neighborhood(init, next);
|
|
||||||
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* a neighborhood explorator solution
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
moSimpleHCexplorer<Neighborhood> explorer(neighborhood);
|
|
||||||
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* the local search algorithm
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
moTrueContinuator<Neighborhood> continuator;
|
|
||||||
|
|
||||||
moLocalSearch< moSimpleHCexplorer<Neighborhood> > localSearch(explorer, continuator);
|
|
||||||
|
|
||||||
/* =========================================================
|
|
||||||
*
|
|
||||||
* execute the local search from random sollution
|
|
||||||
*
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
Indi solution;
|
|
||||||
|
|
||||||
random(solution);
|
|
||||||
|
|
||||||
eval(solution);
|
|
||||||
|
|
||||||
std::cout << "initial: " << solution << std::endl ;
|
|
||||||
|
|
||||||
localSearch(solution);
|
|
||||||
|
|
||||||
std::cout << "final: " << solution << std::endl ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// A main that catches the exceptions
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
main_function(argc, argv);
|
|
||||||
}
|
|
||||||
catch (exception& e)
|
|
||||||
{
|
|
||||||
cout << "Exception: " << e.what() << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "bitMove.h"
|
|
||||||
|
|
||||||
#ifndef __bitMove
|
|
||||||
#define __bitMove
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
#include <move/moMove.h>
|
|
||||||
|
|
||||||
template <class EOT>
|
|
||||||
class BitMove : public moMove <EOT> {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
typedef EOT EOType;
|
|
||||||
|
|
||||||
unsigned bit;
|
|
||||||
|
|
||||||
BitMove() {
|
|
||||||
bit = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BitMove(unsigned _bit) : bit(_bit) { }
|
|
||||||
|
|
||||||
|
|
||||||
void operator () (EOT & chrom)
|
|
||||||
{
|
|
||||||
chrom[bit] = !chrom[bit];
|
|
||||||
};
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "incrEval_funcNK.h"
|
|
||||||
|
|
||||||
#ifndef __incr_eval_funcNK_h
|
|
||||||
#define __incr_eval_funcNK_h
|
|
||||||
|
|
||||||
#include <move/moMoveIncrEval.h>
|
|
||||||
#include "bitMove.h"
|
|
||||||
|
|
||||||
template <class EOT>
|
|
||||||
class OneMaxIncrEval : public moMoveIncrEval < BitMove<EOT> > {
|
|
||||||
|
|
||||||
public :
|
|
||||||
OneMaxIncrEval() { };
|
|
||||||
|
|
||||||
typename EOT::Fitness operator () (const BitMove<EOT> & move, const EOT & chrom) {
|
|
||||||
if (chrom[move.bit]==0) {
|
|
||||||
return chrom.fitness()+1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return chrom.fitness()-1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "bitMove_init.h"
|
|
||||||
#ifndef __bitMove_init
|
|
||||||
#define __bitMove_init
|
|
||||||
|
|
||||||
#include <move/moMoveInit.h>
|
|
||||||
#include "bitMove.h"
|
|
||||||
|
|
||||||
template <class EOT>
|
|
||||||
class BitMove_init : public moMoveInit < BitMove<EOT> > {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
void operator () (BitMove<EOT> & __move, const EOT & genome) {
|
|
||||||
__move.bit = 0 ;
|
|
||||||
};
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "bitMove_next.h"
|
|
||||||
|
|
||||||
#ifndef __bitMove_next_h
|
|
||||||
#define __bitMove_next_h
|
|
||||||
|
|
||||||
#include <move/moNextMove.h>
|
|
||||||
#include "bitMove.h"
|
|
||||||
|
|
||||||
template <class EOT>
|
|
||||||
class BitMove_next : public moNextMove < BitMove<EOT> > {
|
|
||||||
|
|
||||||
public:
|
|
||||||
BitMove_next()
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
bool operator () (BitMove<EOT> & __move, const EOT & genome) {
|
|
||||||
|
|
||||||
if (__move.bit >= (genome.size() - 1)) {
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
__move.bit++;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,328 +0,0 @@
|
||||||
#ifndef __funcNK
|
|
||||||
#define __funcNK
|
|
||||||
|
|
||||||
#include <eo>
|
|
||||||
#include <fstream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
template< class EOT >
|
|
||||||
class FuncNK : public eoEvalFunc<EOT> {
|
|
||||||
public:
|
|
||||||
// tables des contributions
|
|
||||||
double ** tables;
|
|
||||||
|
|
||||||
// liste des liens epistatiques en fonction du bit i
|
|
||||||
// pour chaque contribution, donne la liste des variables consernés
|
|
||||||
unsigned ** links;
|
|
||||||
|
|
||||||
// liste inverse
|
|
||||||
// pour chaque variable, donne la liste indices des contributions
|
|
||||||
vector<unsigned> * knils;
|
|
||||||
|
|
||||||
unsigned N;
|
|
||||||
unsigned K;
|
|
||||||
|
|
||||||
// constructeur vide
|
|
||||||
FuncNK() : N(0), K(0)
|
|
||||||
{
|
|
||||||
tables = NULL;
|
|
||||||
links = NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
FuncNK(unsigned _n) : N(_n), K(0)
|
|
||||||
{
|
|
||||||
tables = NULL;
|
|
||||||
links = NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
// construction de tables aléatoirement
|
|
||||||
FuncNK(int n, int k, bool consecutive = false) : N(n), K(k)
|
|
||||||
{
|
|
||||||
if (consecutive)
|
|
||||||
consecutiveTables();
|
|
||||||
else
|
|
||||||
randomTables();
|
|
||||||
};
|
|
||||||
|
|
||||||
// construction à partir d'un fichier des tables et des liens
|
|
||||||
FuncNK(const char * fichier = "")
|
|
||||||
{
|
|
||||||
load(fichier);
|
|
||||||
};
|
|
||||||
|
|
||||||
~FuncNK()
|
|
||||||
{
|
|
||||||
deleteTables();
|
|
||||||
};
|
|
||||||
|
|
||||||
void buildTables()
|
|
||||||
{
|
|
||||||
links = new unsigned*[N];
|
|
||||||
knils = new vector<unsigned>[N];
|
|
||||||
tables = new double*[N];
|
|
||||||
for(unsigned i = 0; i < N; i++) {
|
|
||||||
tables[i] = new double[1<<(K+1)];
|
|
||||||
links[i] = new unsigned[K+1];
|
|
||||||
knils[i].clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void deleteTables()
|
|
||||||
{
|
|
||||||
if (links != NULL) {
|
|
||||||
for(int i = 0; i < N; i++) {
|
|
||||||
delete [] (links[i]);
|
|
||||||
}
|
|
||||||
delete [] links;
|
|
||||||
links = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (knils != NULL) {
|
|
||||||
/*
|
|
||||||
for(int i = 0; i < N; i++) {
|
|
||||||
knils[i].clear();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
delete [] knils;
|
|
||||||
knils = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tables != NULL) {
|
|
||||||
for(int i = 0; i < N; i++) {
|
|
||||||
delete [] (tables[i]);
|
|
||||||
}
|
|
||||||
delete [] tables;
|
|
||||||
tables = NULL;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual void load(const char * nomTables)
|
|
||||||
{
|
|
||||||
fstream file;
|
|
||||||
file.open(nomTables, ios::in);
|
|
||||||
|
|
||||||
if (file.is_open()) {
|
|
||||||
//cout <<"loadTables: chargement des tables " <<nomTables <<endl;
|
|
||||||
string s;
|
|
||||||
|
|
||||||
// lecture des commentaires
|
|
||||||
string line;
|
|
||||||
file >> s;
|
|
||||||
while (s[0] == 'c') {
|
|
||||||
getline(file,line,'\n');
|
|
||||||
file >> s;
|
|
||||||
}
|
|
||||||
|
|
||||||
// lecture des parametres
|
|
||||||
if (s[0] != 'p') {
|
|
||||||
cerr <<"loadTables: erreur de lecture de paramètre pour " << nomTables <<endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
file >> s;
|
|
||||||
if (s != "NK") {
|
|
||||||
cerr <<"erreur " <<nomTables << " n'est pas un fichier NK" <<endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lecture des paramètres N et K
|
|
||||||
file >> N >> K;
|
|
||||||
buildTables();
|
|
||||||
|
|
||||||
// lecture des liens
|
|
||||||
if (s[0] != 'p') {
|
|
||||||
cerr <<"loadTables: erreur de lecture de paramètre 'links' pour " << nomTables <<endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
file >> s;
|
|
||||||
if (s == "links") {
|
|
||||||
loadLinks(file);
|
|
||||||
} else {
|
|
||||||
cerr <<"loadTables: erreur de lecture de paramètre 'links' pour " << nomTables <<endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lecture des tables
|
|
||||||
if (s[0] != 'p') {
|
|
||||||
cerr <<"loadTables: erreur de lecture de paramètre 'tables' pour " << nomTables <<endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
file >> s;
|
|
||||||
|
|
||||||
if (s == "tables") {
|
|
||||||
loadTables(file);
|
|
||||||
} else {
|
|
||||||
cerr << "loadTables: erreur de lecture de paramètre 'tables' pour " << nomTables <<endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
} else {
|
|
||||||
cerr << "loadTables: impossible d'ouvrir " << nomTables << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
void loadLinks(fstream & file) {
|
|
||||||
for(int j = 0; j < K+1; j++)
|
|
||||||
for(int i = 0; i < N; i++) {
|
|
||||||
file >> links[i][j];
|
|
||||||
knils[links[i][j]].push_back(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadTables(fstream & file) {
|
|
||||||
for(int j = 0; j < (1<<(K+1)); j++)
|
|
||||||
for(int i = 0; i < N; i++)
|
|
||||||
file >> tables[i][j];
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void save(const char * nomTables)
|
|
||||||
{
|
|
||||||
// cout <<"saveTables: sauvegarde de la table " <<nomTables <<endl;
|
|
||||||
fstream file;
|
|
||||||
file.open(nomTables, ios::out);
|
|
||||||
|
|
||||||
if (file.is_open()) {
|
|
||||||
file << "c name of file : " << nomTables << endl;
|
|
||||||
file << "p NK " << N << " " << K <<endl;
|
|
||||||
|
|
||||||
file << "p links" << endl;
|
|
||||||
for(int j=0; j<K+1; j++)
|
|
||||||
for(int i=0; i<N; i++)
|
|
||||||
file << links[i][j] << endl;
|
|
||||||
|
|
||||||
file << "p tables" << endl;
|
|
||||||
for(int j=0; j<(1<<(K+1)); j++) {
|
|
||||||
for(int i=0; i<N; i++)
|
|
||||||
file << tables[i][j] << " ";
|
|
||||||
file << endl;
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
} else {
|
|
||||||
cerr <<"saveTables: impossible d'ouvrir " <<nomTables <<endl;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void affiche()
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for(int i=0; i<N; i++) {
|
|
||||||
cout <<"link " <<i <<" : ";
|
|
||||||
for(j = 0; j <= K; j++)
|
|
||||||
cout <<links[i][j] <<" ";
|
|
||||||
cout <<endl;
|
|
||||||
}
|
|
||||||
cout <<endl;
|
|
||||||
|
|
||||||
for(int i=0; i<N; i++) {
|
|
||||||
cout <<"knils " <<i <<" : ";
|
|
||||||
for(j=0; j<knils[i].size(); j++)
|
|
||||||
cout <<knils[i][j] <<" ";
|
|
||||||
cout <<endl;
|
|
||||||
}
|
|
||||||
cout <<endl;
|
|
||||||
|
|
||||||
for(int i=0; i<N; i++) {
|
|
||||||
cout <<"table " <<i <<endl;
|
|
||||||
for(j=0; j<(1<<(K+1)); j++)
|
|
||||||
cout << tables[i][j] <<endl;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// calcul de la fitness
|
|
||||||
virtual void operator() (EOT & genome)
|
|
||||||
{
|
|
||||||
double accu = 0.0;
|
|
||||||
|
|
||||||
for(int i = 0; i < N; i++)
|
|
||||||
accu += tables[i][sigma(genome,i)];
|
|
||||||
// double M = 0.05;
|
|
||||||
// genome.fitness( M * ((unsigned) (accu / (N*M))) ); // affecte la fitness du genome
|
|
||||||
genome.fitness( accu / (double) N ); // affecte la fitness du genome
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void initTirage(int tabTirage[]) {
|
|
||||||
for(int i = 0; i<N; i++)
|
|
||||||
tabTirage[i] = i;
|
|
||||||
};
|
|
||||||
|
|
||||||
void perm(int tabTirage[],int i, int j) {
|
|
||||||
int k = tabTirage[i];
|
|
||||||
tabTirage[i] = tabTirage[j];
|
|
||||||
tabTirage[j] = k;
|
|
||||||
};
|
|
||||||
|
|
||||||
void tire(int i,int tabTirage[]) {
|
|
||||||
int t[K+1];
|
|
||||||
for(int j=0; j<K+1; j++) {
|
|
||||||
if (j==0) t[j]=i;
|
|
||||||
else t[j] = rng.random(N-j);
|
|
||||||
links[i][j] = tabTirage[t[j]];
|
|
||||||
knils[tabTirage[t[j]]].push_back(i);
|
|
||||||
perm(tabTirage, t[j], N-1-j);
|
|
||||||
}
|
|
||||||
for(int j=K; j>=0; j--)
|
|
||||||
perm(tabTirage, t[j], N-1-j);
|
|
||||||
};
|
|
||||||
|
|
||||||
void consecutiveLinks(int i) {
|
|
||||||
for(int j=0; j<K+1; j++) {
|
|
||||||
links[i][j] = (i + j) % N;
|
|
||||||
knils[(i + j) % N].push_back(i);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// tables et liens aléatoires
|
|
||||||
virtual void randomTables() {
|
|
||||||
buildTables();
|
|
||||||
|
|
||||||
int tabTirage[N];
|
|
||||||
initTirage(tabTirage);
|
|
||||||
|
|
||||||
for(int i = 0; i < N; i++) {
|
|
||||||
// construit les loci epistatiquement liés au locus i
|
|
||||||
tire(i, tabTirage);
|
|
||||||
|
|
||||||
// la table Fi
|
|
||||||
for(int j = 0; j < (1<<(K+1)); j++)
|
|
||||||
tables[i][j] = rng.uniform();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// tables et liens aléatoires
|
|
||||||
virtual void consecutiveTables() {
|
|
||||||
buildTables();
|
|
||||||
|
|
||||||
for(int i = 0; i < N; i++) {
|
|
||||||
// construit les loci epistatiquement liés au locus i
|
|
||||||
consecutiveLinks(i);
|
|
||||||
|
|
||||||
// la table Fi
|
|
||||||
for(int j = 0; j < (1<<(K+1)); j++)
|
|
||||||
tables[i][j] = rng.uniform();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// extrait les bits liés au bit n°i
|
|
||||||
unsigned int sigma(EOT & genome, int i)
|
|
||||||
{
|
|
||||||
unsigned int n = 1;
|
|
||||||
unsigned int accu = 0;
|
|
||||||
for(int j=0; j<K+1; j++) {
|
|
||||||
if (genome[links[i][j]] == 1)
|
|
||||||
accu = accu | n;
|
|
||||||
n = n<<1;
|
|
||||||
}
|
|
||||||
return accu;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// funcOneMax.h
|
|
||||||
// 25/11/2009 : copy from FuncU.h
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef __FuncOneMax
|
|
||||||
#define __FuncOneMax
|
|
||||||
|
|
||||||
template< class EOT >
|
|
||||||
class FuncOneMax : public eoEvalFunc<EOT>
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
unsigned int N;
|
|
||||||
|
|
||||||
public:
|
|
||||||
FuncOneMax(unsigned int n) : N(n) {};
|
|
||||||
|
|
||||||
~FuncOneMax(void) {} ;
|
|
||||||
|
|
||||||
void operator() (EOT & genome) {
|
|
||||||
unsigned int sum = 0;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < N; i++)
|
|
||||||
sum += genome[i];
|
|
||||||
|
|
||||||
genome.fitness(sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
#ifndef __funcRoyalRoad
|
|
||||||
#define __funcRoyalRoad
|
|
||||||
|
|
||||||
#include <eoEvalFunc.h>
|
|
||||||
|
|
||||||
template< class EOT >
|
|
||||||
class FuncRoyalRoad : public eoEvalFunc<EOT>
|
|
||||||
{
|
|
||||||
// number of blocks
|
|
||||||
unsigned n;
|
|
||||||
|
|
||||||
// size of a block
|
|
||||||
unsigned k;
|
|
||||||
|
|
||||||
public:
|
|
||||||
FuncRoyalRoad(unsigned _n, unsigned _k) : n(_n), k(_k) {};
|
|
||||||
|
|
||||||
~FuncRoyalRoad(void) {} ;
|
|
||||||
|
|
||||||
virtual void operator() (EOT & _solution)
|
|
||||||
{
|
|
||||||
unsigned sum = 0;
|
|
||||||
unsigned i, j;
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
j = 0;
|
|
||||||
while (_solution[i * n + j] && j < k) j++;
|
|
||||||
|
|
||||||
if (j == k)
|
|
||||||
sum++;
|
|
||||||
}
|
|
||||||
|
|
||||||
_solution.fitness(sum);
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
#ifndef _oneMaxBitNeighbor_h
|
|
||||||
#define _oneMaxBitNeighbor_h
|
|
||||||
|
|
||||||
#include <problems/bitString/moBitNeighbor.h>
|
|
||||||
#include <ga.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
contener of the neighbor information
|
|
||||||
*/
|
|
||||||
template< class Fitness >
|
|
||||||
class OneMaxBitNeighbor : public moBitNeighbor<Fitness>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef eoBit<Fitness> EOType ;
|
|
||||||
|
|
||||||
using moBitNeighbor<Fitness>::bit ;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* incremental evaluation of the solution for the oneMax problem
|
|
||||||
*/
|
|
||||||
virtual void eval(EOType & solution) {
|
|
||||||
if (solution[bit] == 0)
|
|
||||||
fitness(solution.fitness() + 1);
|
|
||||||
else
|
|
||||||
fitness(solution.fitness() - 1);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Local Variables:
|
|
||||||
// coding: iso-8859-1
|
|
||||||
// mode: C++
|
|
||||||
// c-file-offsets: ((c . 0))
|
|
||||||
// c-file-style: "Stroustrup"
|
|
||||||
// fill-column: 80
|
|
||||||
// End:
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue