* indentations + whitespace cleanup
This commit is contained in:
parent
8457e39efe
commit
56c6edab04
285 changed files with 6068 additions and 6223 deletions
|
|
@ -11,13 +11,14 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
SET(EO_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib)
|
SET(EO_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib)
|
||||||
SET(LIBRARY_OUTPUT_PATH ${EO_LIB_OUTPUT_PATH})
|
SET(LIBRARY_OUTPUT_PATH ${EO_LIB_OUTPUT_PATH})
|
||||||
|
|
||||||
SET (EO_SOURCES eoFunctorStore.cpp
|
SET(EO_SOURCES
|
||||||
|
eoFunctorStore.cpp
|
||||||
eoPersistent.cpp
|
eoPersistent.cpp
|
||||||
eoPrintable.cpp
|
eoPrintable.cpp
|
||||||
eoCtrlCContinue.cpp
|
eoCtrlCContinue.cpp
|
||||||
eoScalarFitnessAssembled.cpp
|
eoScalarFitnessAssembled.cpp
|
||||||
eoSIGContinue.cpp)
|
eoSIGContinue.cpp
|
||||||
|
)
|
||||||
|
|
||||||
ADD_LIBRARY(eo STATIC ${EO_SOURCES})
|
ADD_LIBRARY(eo STATIC ${EO_SOURCES})
|
||||||
INSTALL(TARGETS eo ARCHIVE DESTINATION lib COMPONENT libraries)
|
INSTALL(TARGETS eo ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
|
@ -42,6 +43,6 @@ ADD_SUBDIRECTORY(ga)
|
||||||
ADD_SUBDIRECTORY(gp)
|
ADD_SUBDIRECTORY(gp)
|
||||||
ADD_SUBDIRECTORY(other)
|
ADD_SUBDIRECTORY(other)
|
||||||
ADD_SUBDIRECTORY(utils)
|
ADD_SUBDIRECTORY(utils)
|
||||||
|
ADD_SUBDIRECTORY(pyeo)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,4 +171,3 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -570,4 +570,3 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,3 @@ virtual bool operator()(EOT& , EOT& ) {return false;}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,4 +90,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,4 +90,3 @@ std::vector<double> rates;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,4 +207,3 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*EOCONSTRICTEDVARIABLEWEIGHTVELOCITY_H*/
|
#endif /*EOCONSTRICTEDVARIABLEWEIGHTVELOCITY_H*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,4 +197,3 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
#endif /*EOCONSTRICTEDVELOCITY_H */
|
#endif /*EOCONSTRICTEDVELOCITY_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,4 +68,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,3 @@ public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,4 +71,3 @@ template <class EOT> class eoDetTournamentSelect: public eoSelectOne<EOT>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,4 +314,3 @@ protected:
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif // _eoDualFitness_h_
|
#endif // _eoDualFitness_h_
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,3 @@ template<class EOT> class eoEDA: public eoUF<eoDistribution<EOT>&, void>
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -303,4 +303,3 @@ Example of a test program building an EA algorithm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,3 @@ private :
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __eoEvalCounterThrowException_h__
|
#endif // __eoEvalCounterThrowException_h__
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,3 @@ struct eoEvalFuncPtr: public eoEvalFunc<EOT> {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,4 +211,3 @@ protected:
|
||||||
* Example of a test program using this class:
|
* Example of a test program using this class:
|
||||||
*/
|
*/
|
||||||
#endif /*eoExtendedVelocity_H */
|
#endif /*eoExtendedVelocity_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,3 @@ private :
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,4 +189,3 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
#endif /*EOFIXEDINERTIAWEIGHTEDVELOCITY_H */
|
#endif /*EOFIXEDINERTIAWEIGHTEDVELOCITY_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,4 +112,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,4 +105,3 @@ class eoGeneralBreeder: public eoBreed<EOT>
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,4 +145,3 @@ class eoDummy : public eoUF<POT&, void>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,4 +193,3 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
#endif /*EOINTEGERVELOCITY_H */
|
#endif /*EOINTEGERVELOCITY_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -215,11 +215,3 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*EOLINEARTOPOLOGY_H_ */
|
#endif /*EOLINEARTOPOLOGY_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,14 +55,3 @@ public:
|
||||||
|
|
||||||
|
|
||||||
#endif /* EONEIGHBORHOOD_H_ */
|
#endif /* EONEIGHBORHOOD_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,4 +73,3 @@ class eoObject
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,4 +119,3 @@ class eoOneToOneBreeder: public eoBreed<EOT>
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,4 +166,3 @@ public:
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,3 @@ public:
|
||||||
#endif /*_EOPARTICLEBESTINIT_H */
|
#endif /*_EOPARTICLEBESTINIT_H */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,4 +153,3 @@ template <class POT> class eoParticleInitializer : public eoInitializerBase <POT
|
||||||
#endif /*_eoParticleFullInitializer_H*/
|
#endif /*_eoParticleFullInitializer_H*/
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,3 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -337,4 +337,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,4 +105,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,4 +209,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,3 @@ std::ostream & operator << ( std::ostream& _os, const eoPrintable& _o ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,4 +60,3 @@ class eoPrintable
|
||||||
std::ostream & operator << ( std::ostream& _os, const eoPrintable& _o );
|
std::ostream & operator << ( std::ostream& _os, const eoPrintable& _o );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,4 +91,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,4 +121,3 @@ class eoSTLBF : public std::binary_function<A1, A2, R>
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,3 @@
|
||||||
|
|
||||||
// need to allocate the static variables of class eoScalarFitnessAssembledTraits
|
// need to allocate the static variables of class eoScalarFitnessAssembledTraits
|
||||||
std::vector<std::string> eoScalarFitnessAssembledTraits::TermDescriptions;
|
std::vector<std::string> eoScalarFitnessAssembledTraits::TermDescriptions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -282,4 +282,3 @@ std::istream& operator>>(std::istream& is, eoScalarFitnessAssembled<F, Cmp, Fitn
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,4 +74,3 @@ public:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,4 +229,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,4 +89,3 @@ template<class EOT> class eoShiftMutation: public eoMonOp<EOT>
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,4 +104,3 @@ template<class EOT> class eoSimpleEDA: public eoEDA<EOT>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,4 +123,3 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
#endif /* EOSOCIALNEIGHBORHOOD_H_ */
|
#endif /* EOSOCIALNEIGHBORHOOD_H_ */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,4 +193,3 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
#endif /*EOSTANDARDVELOCITY_H */
|
#endif /*EOSTANDARDVELOCITY_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,11 +139,3 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*EOSTARTOPOLOGY_H_ */
|
#endif /*EOSTARTOPOLOGY_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,4 +117,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,4 +195,3 @@ private :
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,3 @@ template<class Chrom> class eoSwapMutation: public eoMonOp<Chrom>
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,11 +84,3 @@ public:
|
||||||
|
|
||||||
|
|
||||||
#endif /*EOTOPOLOGY_H_ */
|
#endif /*EOTOPOLOGY_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,4 +196,3 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*EOVARIABLEINERTIAWEIGHTEDVELOCITY_H*/
|
#endif /*EOVARIABLEINERTIAWEIGHTEDVELOCITY_H*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -350,4 +350,3 @@ private:
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,4 +158,3 @@ private:
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,4 +78,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*EOVELOCITY_H_H */
|
#endif /*EOVELOCITY_H_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,4 +144,3 @@ private:
|
||||||
#endif /*EOVELOCITYINIT_H */
|
#endif /*EOVELOCITYINIT_H */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C++ification of Nikolaus Hansen's original C-source code for the
|
* C++ification of Nikolaus Hansen's original C-source code for the
|
||||||
* CMA-ES
|
* CMA-ES
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,3 @@ class CMAParams {
|
||||||
} // namespace eo
|
} // namespace eo
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -362,4 +362,3 @@ bool CMAState::updateEigenSystem(unsigned max_tries, unsigned max_iters) { retur
|
||||||
|
|
||||||
|
|
||||||
} // namespace eo
|
} // namespace eo
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C++ification of Nikolaus Hansen's original C-source code for the
|
* C++ification of Nikolaus Hansen's original C-source code for the
|
||||||
* CMA-ES.
|
* CMA-ES.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C++ification of Nikolaus Hansen's original C-source code for the
|
* C++ification of Nikolaus Hansen's original C-source code for the
|
||||||
* CMA-ES. These are the eigenvector calculations
|
* CMA-ES. These are the eigenvector calculations
|
||||||
|
|
|
||||||
|
|
@ -279,4 +279,3 @@ private:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//@}
|
//@}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,4 +68,3 @@ class eoRealInitBounded : public eoInit<EOT>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//@}
|
//@}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,5 +133,3 @@ protected:
|
||||||
double eta;
|
double eta;
|
||||||
double range; // == 1
|
double range; // == 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,4 +82,3 @@ eoAlgo<eoEsFull<eoMinimizingFitness> >& make_algo_scalar(eoParser& _parser, eoS
|
||||||
{
|
{
|
||||||
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
|
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,4 +58,3 @@ eoAlgo<eoReal<eoMinimizingFitness> >& make_algo_scalar(eoParser& _parser, eoSta
|
||||||
{
|
{
|
||||||
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op, _dist);
|
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op, _dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,5 +79,3 @@ eoCheckPoint<eoEsFull<eoMinimizingFitness> >& make_checkpoint(eoParser& _parser,
|
||||||
{
|
{
|
||||||
return do_make_checkpoint(_parser, _state, _eval, _continue);
|
return do_make_checkpoint(_parser, _state, _eval, _continue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,5 +57,3 @@ eoCheckPoint<eoReal<eoMinimizingFitness> >& make_checkpoint(eoParser& _parser, e
|
||||||
{
|
{
|
||||||
return do_make_checkpoint(_parser, _state, _eval, _continue);
|
return do_make_checkpoint(_parser, _state, _eval, _continue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,5 +79,3 @@ eoContinue<eoEsFull<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoS
|
||||||
{
|
{
|
||||||
return do_make_continue(_parser, _state, _eval);
|
return do_make_continue(_parser, _state, _eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,5 +57,3 @@ eoContinue<eoReal<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoSta
|
||||||
{
|
{
|
||||||
return do_make_continue(_parser, _state, _eval);
|
return do_make_continue(_parser, _state, _eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,4 +77,3 @@ eoGenOp<eoEsFull<eoMinimizingFitness> >& make_op(eoParser& _parser, eoState& _s
|
||||||
{
|
{
|
||||||
return do_make_op(_parser, _state, _init);
|
return do_make_op(_parser, _state, _init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,5 +82,3 @@ eoPop<eoEsFull<eoMinimizingFitness> >& make_pop(eoParser& _parser, eoState& _st
|
||||||
{
|
{
|
||||||
return do_make_pop(_parser, _state, _init);
|
return do_make_pop(_parser, _state, _init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,5 +58,3 @@ eoPop<eoReal<eoMinimizingFitness> >& make_pop(eoParser& _parser, eoState& _stat
|
||||||
{
|
{
|
||||||
return do_make_pop(_parser, _state, _init);
|
return do_make_pop(_parser, _state, _init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,3 @@ void run_ea(eoAlgo<eoEsFull<eoMinimizingFitness> >& _ga, eoPop<eoEsFull<eoMinimi
|
||||||
{
|
{
|
||||||
do_run(_ga, _pop);
|
do_run(_ga, _pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,4 +60,3 @@ void run_ea(eoAlgo<eoReal<eoMinimizingFitness> >& _ga, eoPop<eoReal<eoMinimizing
|
||||||
{
|
{
|
||||||
do_run(_ga, _pop);
|
do_run(_ga, _pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,3 @@ class square_matrix {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,3 @@ that constructs the EOType initializer (make_genotype.h) and the one
|
||||||
that buils up the operators (make_op.h).
|
that buils up the operators (make_op.h).
|
||||||
|
|
||||||
MS, April 23, 2001CVS
|
MS, April 23, 2001CVS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -442,4 +442,3 @@ template<class Chrom> class eoBitGxOver: public eoQuadOp<Chrom>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//@}
|
//@}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,4 +170,3 @@ public:
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,4 +61,3 @@ eoAlgo<eoBit<eoMinimizingFitness> >& make_algo_scalar(eoParser& _parser, eoStat
|
||||||
{
|
{
|
||||||
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op, _dist);
|
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op, _dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,5 +60,3 @@ eoCheckPoint<eoBit<eoMinimizingFitness> >& make_checkpoint(eoParser& _parser, eo
|
||||||
{
|
{
|
||||||
return do_make_checkpoint(_parser, _state, _eval, _continue);
|
return do_make_checkpoint(_parser, _state, _eval, _continue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,5 +60,3 @@ eoContinue<eoBit<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoStat
|
||||||
{
|
{
|
||||||
return do_make_continue(_parser, _state, _eval);
|
return do_make_continue(_parser, _state, _eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,4 +59,3 @@ eoGenOp<eoBit<eoMinimizingFitness> >& make_op(eoParser& _parser, eoState& _stat
|
||||||
{
|
{
|
||||||
return do_make_op(_parser, _state, _init);
|
return do_make_op(_parser, _state, _init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,5 +59,3 @@ eoPop<eoBit<eoMinimizingFitness> >& make_pop(eoParser& _parser, eoState& _state
|
||||||
{
|
{
|
||||||
return do_make_pop(_parser, _state, _init);
|
return do_make_pop(_parser, _state, _init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,3 @@ void run_ea(eoAlgo<eoBit<eoMinimizingFitness> >& _ga, eoPop<eoBit<eoMinimizingFi
|
||||||
{
|
{
|
||||||
do_run(_ga, _pop);
|
do_run(_ga, _pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,4 +82,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,5 +33,3 @@ eoFunctorStore.o: ../eoFunctorStore.h ../eoFunctorStore.cpp
|
||||||
|
|
||||||
%.o:%.cpp PyEO.h def_abstract_functor.h
|
%.o:%.cpp PyEO.h def_abstract_functor.h
|
||||||
$(COMPILE) $< $(INC)
|
$(COMPILE) $< $(INC)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,3 @@ eoFunctorStore.o: ../eoFunctorStore.h ../eoFunctorStore.cpp
|
||||||
|
|
||||||
%.o:%.cpp PyEO.h def_abstract_functor.h
|
%.o:%.cpp PyEO.h def_abstract_functor.h
|
||||||
$(COMPILE) $< $(INC)
|
$(COMPILE) $< $(INC)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,15 @@
|
||||||
#ifndef PYEO_H
|
#ifndef PYEO_H
|
||||||
#define PYEO_H
|
#define PYEO_H
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
|
|
||||||
#include <EO.h>
|
#include <EO.h>
|
||||||
struct index_error : public std::exception {
|
|
||||||
|
struct index_error : public std::exception
|
||||||
|
{
|
||||||
index_error(std::string w) : what(w) {};
|
index_error(std::string w) : what(w) {};
|
||||||
virtual ~index_error() throw() {}
|
virtual ~index_error() throw() {}
|
||||||
std::string what;
|
std::string what;
|
||||||
|
|
@ -36,7 +37,7 @@ struct index_error : public std::exception {
|
||||||
|
|
||||||
class PyFitness : public boost::python::object
|
class PyFitness : public boost::python::object
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
typedef PyFitness fitness_traits; // it's its own traits class :-)
|
typedef PyFitness fitness_traits; // it's its own traits class :-)
|
||||||
|
|
||||||
|
|
@ -140,13 +141,12 @@ struct PyEO_pickle_suite : boost::python::pickle_suite
|
||||||
{
|
{
|
||||||
typedef PyEO::Fitness Fitness;
|
typedef PyEO::Fitness Fitness;
|
||||||
|
|
||||||
static
|
static boost::python::tuple getstate(const PyEO& _eo)
|
||||||
boost::python::tuple getstate(const PyEO& _eo)
|
|
||||||
{
|
{
|
||||||
return boost::python::make_tuple(_eo.getFitness(), _eo.genome);
|
return boost::python::make_tuple(_eo.getFitness(), _eo.genome);
|
||||||
}
|
}
|
||||||
static
|
|
||||||
void setstate(PyEO& _eo, boost::python::tuple pickled)
|
static void setstate(PyEO& _eo, boost::python::tuple pickled)
|
||||||
{
|
{
|
||||||
_eo.setFitness( Fitness(pickled[0]) );
|
_eo.setFitness( Fitness(pickled[0]) );
|
||||||
_eo.genome = pickled[1];
|
_eo.genome = pickled[1];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
from PyEO import *
|
from PyEO import *
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -15,7 +14,6 @@ else:
|
||||||
self.g = Gnuplot.Gnuplot()
|
self.g = Gnuplot.Gnuplot()
|
||||||
self.g.reset();
|
self.g.reset();
|
||||||
|
|
||||||
|
|
||||||
def handleParam(self, i, param):
|
def handleParam(self, i, param):
|
||||||
param = float(param)
|
param = float(param)
|
||||||
|
|
||||||
|
|
@ -25,7 +23,6 @@ else:
|
||||||
self.values[i].append(param)
|
self.values[i].append(param)
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
|
||||||
l = len(self)
|
l = len(self)
|
||||||
|
|
||||||
if l > 3 or l == 0:
|
if l > 3 or l == 0:
|
||||||
|
|
@ -82,6 +79,5 @@ class eoAverageStat(eoStat):
|
||||||
self.object = sum
|
self.object = sum
|
||||||
|
|
||||||
class eoBestFitnessStat(eoSortedStat):
|
class eoBestFitnessStat(eoSortedStat):
|
||||||
|
|
||||||
def __call__(self, pop):
|
def __call__(self, pop):
|
||||||
self.object = pop[0].fitness
|
self.object = pop[0].fitness
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,15 @@ void abstract1()
|
||||||
|
|
||||||
def_abstract_functor<eoTransform<PyEO> >("eoTransform");
|
def_abstract_functor<eoTransform<PyEO> >("eoTransform");
|
||||||
|
|
||||||
class_<eoSGATransform<PyEO>, bases<eoTransform<PyEO> > >("eoSGATransform",
|
class_<eoSGATransform<PyEO>, bases<eoTransform<PyEO> > >
|
||||||
init< eoQuadOp<PyEO>&, double,
|
("eoSGATransform",
|
||||||
eoMonOp<PyEO>&, double>())
|
init<
|
||||||
|
eoQuadOp<PyEO>&,
|
||||||
|
double,
|
||||||
|
eoMonOp<PyEO>&,
|
||||||
|
double
|
||||||
|
>()
|
||||||
|
)
|
||||||
.def("__call__", &eoSGATransform<PyEO>::operator());
|
.def("__call__", &eoSGATransform<PyEO>::operator());
|
||||||
|
|
||||||
def_abstract_functor<eoPopEvalFunc<PyEO> >("eoPopEvalFunc");
|
def_abstract_functor<eoPopEvalFunc<PyEO> >("eoPopEvalFunc");
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,17 @@ void algos()
|
||||||
def_abstract_functor<eoAlgo<PyEO> >("eoAlgo");
|
def_abstract_functor<eoAlgo<PyEO> >("eoAlgo");
|
||||||
|
|
||||||
/* Algorithms */
|
/* Algorithms */
|
||||||
class_<eoSGA<PyEO>, bases<eoAlgo<PyEO> >, boost::noncopyable>("eoSGA",
|
class_<eoSGA<PyEO>, bases<eoAlgo<PyEO> >, boost::noncopyable>
|
||||||
init<eoSelectOne<PyEO>&,
|
("eoSGA",
|
||||||
eoQuadOp<PyEO>&, float,
|
init<
|
||||||
eoMonOp<PyEO>&, float,
|
eoSelectOne<PyEO>&,
|
||||||
|
eoQuadOp<PyEO>&,
|
||||||
|
float,
|
||||||
|
eoMonOp<PyEO>&,
|
||||||
|
float,
|
||||||
eoEvalFunc<PyEO>&,
|
eoEvalFunc<PyEO>&,
|
||||||
eoContinue<PyEO>&>()
|
eoContinue<PyEO>&
|
||||||
|
>()
|
||||||
[
|
[
|
||||||
with_custodian_and_ward<1,2,
|
with_custodian_and_ward<1,2,
|
||||||
with_custodian_and_ward<1,3,
|
with_custodian_and_ward<1,3,
|
||||||
|
|
@ -49,40 +54,55 @@ void algos()
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
>()
|
>()
|
||||||
])
|
]
|
||||||
|
)
|
||||||
.def("__call__", &eoSGA<PyEO>::operator())
|
.def("__call__", &eoSGA<PyEO>::operator())
|
||||||
;
|
;
|
||||||
|
|
||||||
class_<eoEasyEA<PyEO>, bases<eoAlgo<PyEO> > >("eoEasyEA",
|
class_<eoEasyEA<PyEO>, bases<eoAlgo<PyEO> > >
|
||||||
|
("eoEasyEA",
|
||||||
init<
|
init<
|
||||||
eoContinue<PyEO>&,
|
eoContinue<PyEO>&,
|
||||||
eoEvalFunc<PyEO>&,
|
eoEvalFunc<PyEO>&,
|
||||||
eoBreed<PyEO>&,
|
eoBreed<PyEO>&,
|
||||||
eoReplacement<PyEO>& >() )
|
eoReplacement<PyEO>&
|
||||||
|
>()
|
||||||
|
)
|
||||||
|
.def( init<
|
||||||
|
eoContinue<PyEO>&,
|
||||||
|
eoEvalFunc<PyEO>&,
|
||||||
|
eoBreed<PyEO>&,
|
||||||
|
eoReplacement<PyEO>&,
|
||||||
|
unsigned
|
||||||
|
>() )
|
||||||
.def( init<
|
.def( init<
|
||||||
eoContinue<PyEO>&,
|
eoContinue<PyEO>&,
|
||||||
eoPopEvalFunc<PyEO>&,
|
eoPopEvalFunc<PyEO>&,
|
||||||
eoBreed<PyEO>&,
|
eoBreed<PyEO>&,
|
||||||
eoReplacement<PyEO>&>() )
|
eoReplacement<PyEO>&
|
||||||
|
>() )
|
||||||
.def( init<
|
.def( init<
|
||||||
eoContinue<PyEO>&,
|
eoContinue<PyEO>&,
|
||||||
eoEvalFunc<PyEO>&,
|
eoEvalFunc<PyEO>&,
|
||||||
eoBreed<PyEO>&,
|
eoBreed<PyEO>&,
|
||||||
eoMerge<PyEO>&,
|
eoMerge<PyEO>&,
|
||||||
eoReduce<PyEO>& >() )
|
eoReduce<PyEO>&
|
||||||
|
>() )
|
||||||
.def( init<
|
.def( init<
|
||||||
eoContinue<PyEO>&,
|
eoContinue<PyEO>&,
|
||||||
eoEvalFunc<PyEO>&,
|
eoEvalFunc<PyEO>&,
|
||||||
eoSelect<PyEO>&,
|
eoSelect<PyEO>&,
|
||||||
eoTransform<PyEO>&,
|
eoTransform<PyEO>&,
|
||||||
eoReplacement<PyEO>&>())
|
eoReplacement<PyEO>&
|
||||||
|
>() )
|
||||||
.def( init<
|
.def( init<
|
||||||
eoContinue<PyEO>&,
|
eoContinue<PyEO>&,
|
||||||
eoEvalFunc<PyEO>&,
|
eoEvalFunc<PyEO>&,
|
||||||
eoSelect<PyEO>&,
|
eoSelect<PyEO>&,
|
||||||
eoTransform<PyEO>&,
|
eoTransform<PyEO>&,
|
||||||
eoMerge<PyEO>&,
|
eoMerge<PyEO>&,
|
||||||
eoReduce<PyEO>&>())
|
eoReduce<PyEO>&
|
||||||
|
>() )
|
||||||
.def("__call__", &eoEasyEA<PyEO>::operator())
|
.def("__call__", &eoEasyEA<PyEO>::operator())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,18 @@
|
||||||
|
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
|
|
||||||
#define DEF3(x, i1, i2) class_<x<PyEO>, bases<eoBreed<PyEO > > >(#x, \
|
#define DEF3(x, i1, i2) \
|
||||||
init<i1, i2 >()[with_custodian_and_ward<1,2,with_custodian_and_ward<1,3> >()])\
|
class_<x<PyEO>, bases<eoBreed<PyEO > > > \
|
||||||
|
(#x, \
|
||||||
|
init<i1, i2 >() \
|
||||||
|
[ \
|
||||||
|
with_custodian_and_ward<1,2, \
|
||||||
|
with_custodian_and_ward<1,3 \
|
||||||
|
> \
|
||||||
|
> \
|
||||||
|
() \
|
||||||
|
] \
|
||||||
|
) \
|
||||||
.def("__call__", &eoBreed<PyEO>::operator())
|
.def("__call__", &eoBreed<PyEO>::operator())
|
||||||
|
|
||||||
void breeders()
|
void breeders()
|
||||||
|
|
@ -46,6 +56,4 @@ void breeders()
|
||||||
DEF3(eoOneToOneBreeder, eoGenOp<PyEO>&, eoEvalFunc<PyEO>&)
|
DEF3(eoOneToOneBreeder, eoGenOp<PyEO>&, eoEvalFunc<PyEO>&)
|
||||||
.def( init<eoGenOp<PyEO>&, eoEvalFunc<PyEO>&, double>()[WC2] )
|
.def( init<eoGenOp<PyEO>&, eoEvalFunc<PyEO>&, double>()[WC2] )
|
||||||
.def( init<eoGenOp<PyEO>&, eoEvalFunc<PyEO>&, double, eoHowMany>()[WC2] );
|
.def( init<eoGenOp<PyEO>&, eoEvalFunc<PyEO>&, double, eoHowMany>()[WC2] );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,25 +41,31 @@ void continuators()
|
||||||
{
|
{
|
||||||
/* Counters, wrappers etc */
|
/* Counters, wrappers etc */
|
||||||
|
|
||||||
class_<eoEvalFuncCounter<PyEO>, bases<eoEvalFunc<PyEO> > >("eoEvalFuncCounter",
|
class_<eoEvalFuncCounter<PyEO>, bases<eoEvalFunc<PyEO> > >
|
||||||
init< eoEvalFunc<PyEO>&, std::string>())
|
("eoEvalFuncCounter",
|
||||||
|
init< eoEvalFunc<PyEO>&, std::string>()
|
||||||
|
)
|
||||||
.def("__call__", &eoEvalFuncCounter<PyEO>::operator())
|
.def("__call__", &eoEvalFuncCounter<PyEO>::operator())
|
||||||
;
|
;
|
||||||
/* Continuators */
|
/* Continuators */
|
||||||
def_abstract_functor<eoContinue<PyEO> >("eoContinue");
|
def_abstract_functor<eoContinue<PyEO> >("eoContinue");
|
||||||
|
|
||||||
class_<eoGenContinue<PyEO>, bases<eoContinue<PyEO> >, boost::noncopyable >("eoGenContinue", init<unsigned long>() )
|
class_<eoGenContinue<PyEO>, bases<eoContinue<PyEO> >, boost::noncopyable >
|
||||||
|
("eoGenContinue", init<unsigned long>() )
|
||||||
.def("__call__", &eoGenContinue<PyEO>::operator())
|
.def("__call__", &eoGenContinue<PyEO>::operator())
|
||||||
;
|
;
|
||||||
|
|
||||||
class_<eoCombinedContinue<PyEO>, bases<eoContinue<PyEO> > >("eoCombinedContinue", init<eoContinue<PyEO>&>()[WC1])
|
class_<eoCombinedContinue<PyEO>, bases<eoContinue<PyEO> > >
|
||||||
|
("eoCombinedContinue", init<eoContinue<PyEO>&>()[WC1])
|
||||||
.def( init<eoContinue<PyEO>&, eoContinue<PyEO>& >()[WC2] )
|
.def( init<eoContinue<PyEO>&, eoContinue<PyEO>& >()[WC2] )
|
||||||
.def("add", &eoCombinedContinue<PyEO>::add, WC1)
|
.def("add", &eoCombinedContinue<PyEO>::add, WC1)
|
||||||
.def("__call__", &eoCombinedContinue<PyEO>::operator())
|
.def("__call__", &eoCombinedContinue<PyEO>::operator())
|
||||||
;
|
;
|
||||||
|
|
||||||
class_<eoEvalContinue<PyEO>, bases<eoContinue<PyEO> > >("eoEvalContinue",
|
class_<eoEvalContinue<PyEO>, bases<eoContinue<PyEO> > >
|
||||||
init<eoEvalFuncCounter<PyEO>&, unsigned long>()[WC1])
|
("eoEvalContinue",
|
||||||
|
init<eoEvalFuncCounter<PyEO>&, unsigned long>()[WC1]
|
||||||
|
)
|
||||||
.def("__call__", &eoEvalContinue<PyEO>::operator())
|
.def("__call__", &eoEvalContinue<PyEO>::operator())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -77,8 +83,8 @@ void addSortedStat(eoCheckPoint<PyEO>& c, eoSortedStatBase<PyEO>& s) { c.add(s);
|
||||||
|
|
||||||
void add_checkpoint()
|
void add_checkpoint()
|
||||||
{
|
{
|
||||||
class_<eoCheckPoint<PyEO>, bases< eoContinue<PyEO> > >("eoCheckPoint",
|
class_<eoCheckPoint<PyEO>, bases< eoContinue<PyEO> > >
|
||||||
|
("eoCheckPoint",
|
||||||
init<eoContinue<PyEO>&> ()[with_custodian_and_ward<1,2>()]
|
init<eoContinue<PyEO>&> ()[with_custodian_and_ward<1,2>()]
|
||||||
)
|
)
|
||||||
.def("add", addContinue, with_custodian_and_ward<1,2>() )
|
.def("add", addContinue, with_custodian_and_ward<1,2>() )
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@
|
||||||
|
|
||||||
namespace eoutils {
|
namespace eoutils {
|
||||||
|
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
|
|
||||||
template <class Proc>
|
template <class Proc>
|
||||||
class ProcWrapper : public Proc
|
class ProcWrapper : public Proc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PyObject* self;
|
PyObject* self;
|
||||||
ProcWrapper(PyObject* s) : self(s) {}
|
ProcWrapper(PyObject* s) : self(s) {}
|
||||||
|
|
@ -42,27 +42,27 @@ class ProcWrapper : public Proc
|
||||||
{
|
{
|
||||||
return boost::python::call_method<typename Proc::result_type>(self, "__call__");
|
return boost::python::call_method<typename Proc::result_type>(self, "__call__");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Proc>
|
template <class Proc>
|
||||||
void make_abstract_functor(std::string name, typename eoFunctorBase::procedure_tag)
|
void make_abstract_functor(std::string name, typename eoFunctorBase::procedure_tag)
|
||||||
{
|
{
|
||||||
typedef ProcWrapper<Proc> Wrapper;
|
typedef ProcWrapper<Proc> Wrapper;
|
||||||
boost::python::class_<Proc, Wrapper,boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
boost::python::class_<Proc, Wrapper,boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
||||||
.def("__call__", &Wrapper::operator());
|
.def("__call__", &Wrapper::operator());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Proc>
|
template <class Proc>
|
||||||
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::procedure_tag)
|
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::procedure_tag)
|
||||||
{
|
{
|
||||||
typedef ProcWrapper<Proc> Wrapper;
|
typedef ProcWrapper<Proc> Wrapper;
|
||||||
boost::python::class_<Proc, Wrapper,boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
boost::python::class_<Proc, Wrapper,boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
||||||
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>());
|
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Unary>
|
template <class Unary>
|
||||||
class UnaryWrapper : public Unary
|
class UnaryWrapper : public Unary
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PyObject* self;
|
PyObject* self;
|
||||||
UnaryWrapper(PyObject* s) : self(s) {}
|
UnaryWrapper(PyObject* s) : self(s) {}
|
||||||
|
|
@ -71,31 +71,31 @@ class UnaryWrapper : public Unary
|
||||||
{
|
{
|
||||||
return boost::python::call_method<typename Unary::result_type>(self, "__call__", boost::ref(a) );
|
return boost::python::call_method<typename Unary::result_type>(self, "__call__", boost::ref(a) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Unary>
|
template <class Unary>
|
||||||
void make_abstract_functor(std::string name, typename eoFunctorBase::unary_function_tag)
|
void make_abstract_functor(std::string name, typename eoFunctorBase::unary_function_tag)
|
||||||
{
|
{
|
||||||
typedef UnaryWrapper<Unary> Wrapper;
|
typedef UnaryWrapper<Unary> Wrapper;
|
||||||
|
|
||||||
boost::python::class_<Unary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
boost::python::class_<Unary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
||||||
.def("__call__", &Wrapper::operator())
|
.def("__call__", &Wrapper::operator())
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Unary>
|
template <class Unary>
|
||||||
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::unary_function_tag)
|
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::unary_function_tag)
|
||||||
{
|
{
|
||||||
typedef UnaryWrapper<Unary> Wrapper;
|
typedef UnaryWrapper<Unary> Wrapper;
|
||||||
|
|
||||||
boost::python::class_<Unary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
boost::python::class_<Unary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
||||||
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>() )
|
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>() )
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Binary>
|
template <class Binary>
|
||||||
class BinaryWrapper : public Binary
|
class BinaryWrapper : public Binary
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PyObject* self;
|
PyObject* self;
|
||||||
BinaryWrapper(PyObject* s) : self(s) {}
|
BinaryWrapper(PyObject* s) : self(s) {}
|
||||||
|
|
@ -104,23 +104,23 @@ class BinaryWrapper : public Binary
|
||||||
return boost::python::call_method<
|
return boost::python::call_method<
|
||||||
typename Binary::result_type>(self, "__call__", boost::ref(a1), boost::ref(a2) );
|
typename Binary::result_type>(self, "__call__", boost::ref(a1), boost::ref(a2) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Binary>
|
template <class Binary>
|
||||||
void make_abstract_functor(std::string name, typename eoFunctorBase::binary_function_tag)
|
void make_abstract_functor(std::string name, typename eoFunctorBase::binary_function_tag)
|
||||||
{
|
{
|
||||||
typedef BinaryWrapper<Binary> Wrapper;
|
typedef BinaryWrapper<Binary> Wrapper;
|
||||||
boost::python::class_<Binary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
boost::python::class_<Binary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
||||||
.def("__call__", &Wrapper::operator());
|
.def("__call__", &Wrapper::operator());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Binary>
|
template <class Binary>
|
||||||
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::binary_function_tag)
|
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::binary_function_tag)
|
||||||
{
|
{
|
||||||
typedef BinaryWrapper<Binary> Wrapper;
|
typedef BinaryWrapper<Binary> Wrapper;
|
||||||
boost::python::class_<Binary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
boost::python::class_<Binary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
|
||||||
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>() );
|
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}// namespace eoutils
|
}// namespace eoutils
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ using namespace boost::python;
|
||||||
|
|
||||||
class GenOpWrapper : public eoGenOp<PyEO>
|
class GenOpWrapper : public eoGenOp<PyEO>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PyObject* self;
|
PyObject* self;
|
||||||
GenOpWrapper(PyObject* p) : self(p) {}
|
GenOpWrapper(PyObject* p) : self(p) {}
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,3 @@ void mergers()
|
||||||
DEF(eoPlus);
|
DEF(eoPlus);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ using namespace boost::python;
|
||||||
|
|
||||||
class MonitorWrapper : public eoMonitor
|
class MonitorWrapper : public eoMonitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PyObject* self;
|
PyObject* self;
|
||||||
list objects;
|
list objects;
|
||||||
|
|
||||||
|
|
@ -69,4 +69,3 @@ void monitors()
|
||||||
.def("__len__", &MonitorWrapper::size)
|
.def("__len__", &MonitorWrapper::size)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <eoNDSorting.h>
|
#include <eoNDSorting.h>
|
||||||
|
|
||||||
#include "PyEO.h"
|
#include "PyEO.h"
|
||||||
|
|
@ -32,7 +33,6 @@ struct Perf2WorthWrapper : public eoPerf2Worth<PyEO,double>
|
||||||
{
|
{
|
||||||
call_method<void>(self, "__call__", boost::ref(pop));
|
call_method<void>(self, "__call__", boost::ref(pop));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
numeric::array get_worths(eoPerf2Worth<PyEO, double>& p)
|
numeric::array get_worths(eoPerf2Worth<PyEO, double>& p)
|
||||||
|
|
@ -61,8 +61,7 @@ void perf2worth()
|
||||||
{
|
{
|
||||||
//numeric::array::set_module_and_type("Numeric", "ArrayType");
|
//numeric::array::set_module_and_type("Numeric", "ArrayType");
|
||||||
|
|
||||||
class_<
|
class_<eoPerf2Worth<PyEO, double>,
|
||||||
eoPerf2Worth<PyEO, double>,
|
|
||||||
Perf2WorthWrapper,
|
Perf2WorthWrapper,
|
||||||
bases< eoValueParam<std::vector<double> > >,
|
bases< eoValueParam<std::vector<double> > >,
|
||||||
boost::noncopyable>("eoPerf2Worth", init<>())
|
boost::noncopyable>("eoPerf2Worth", init<>())
|
||||||
|
|
@ -72,17 +71,19 @@ void perf2worth()
|
||||||
//.def("value", get_worths)
|
//.def("value", get_worths)
|
||||||
;
|
;
|
||||||
|
|
||||||
class_<eoPerf2WorthCached<PyEO, double>, CachedPerf2WorthWrapper, bases<eoPerf2Worth<PyEO, double> >, boost::noncopyable>
|
class_<eoPerf2WorthCached<PyEO, double>,
|
||||||
("eoPerf2WorthCached", init<>())
|
CachedPerf2WorthWrapper,
|
||||||
|
bases<eoPerf2Worth<PyEO, double> >,
|
||||||
|
boost::noncopyable>("eoPerf2WorthCached", init<>())
|
||||||
|
|
||||||
.def("__call__", &eoPerf2WorthCached<PyEO, double>::operator())
|
.def("__call__", &eoPerf2WorthCached<PyEO, double>::operator())
|
||||||
.def("calculate_worths", &CachedPerf2WorthWrapper::calculate_worths)
|
.def("calculate_worths", &CachedPerf2WorthWrapper::calculate_worths)
|
||||||
;
|
;
|
||||||
|
|
||||||
//class_<eoNoPerf2Worth<PyEO>, bases<eoPerf2Worth<PyEO, double> > >("eoNoPerf2Worth")
|
//class_<eoNoPerf2Worth<PyEO>, bases<eoPerf2Worth<PyEO, double> > >("eoNoPerf2Worth")
|
||||||
// .def("__call__", &eoNoPerf2Worth<PyEO>::operator());
|
// .def("__call__", &eoNoPerf2Worth<PyEO>::operator());
|
||||||
|
|
||||||
class_<eoNDSorting_II<PyEO>, bases<eoPerf2WorthCached<PyEO, double> > >("eoNDSorting_II")
|
class_<eoNDSorting_II<PyEO>,
|
||||||
|
bases<eoPerf2WorthCached<PyEO, double> > >("eoNDSorting_II")
|
||||||
.def("calculate_worths", &eoNDSorting_II<PyEO>::calculate_worths);
|
.def("calculate_worths", &eoNDSorting_II<PyEO>::calculate_worths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue