本文整理匯總了Python中GPopulation.GPopulation.worstRaw方法的典型用法代碼示例。如果您正苦於以下問題:Python GPopulation.worstRaw方法的具體用法?Python GPopulation.worstRaw怎麽用?Python GPopulation.worstRaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GPopulation.GPopulation
的用法示例。
在下文中一共展示了GPopulation.worstRaw方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: your_func
# 需要導入模塊: from GPopulation import GPopulation [as 別名]
# 或者: from GPopulation.GPopulation import worstRaw [as 別名]
#.........這裏部分代碼省略.........
def setElitism(self, flag):
""" Sets the elitism option, True or False
:param flag: True or False
"""
if type(flag) != BooleanType:
Util.raiseException("Elitism option must be True or False", TypeError)
self.elitism = flag
def getDBAdapter(self):
""" Gets the DB Adapter of the GA Engine
:rtype: a instance from one of the :mod:`DBAdapters` classes
"""
return self.dbAdapter
def bestIndividual(self):
""" Returns the population best individual
:rtype: the best individual
"""
return self.internalPop.bestRaw()
def worstIndividual(self):
""" Returns the population worst individual
:rtype: the best individual
"""
return self.internalPop.worstRaw()
def __gp_catch_functions(self, prefix):
""" Internally used to catch functions with some specific prefix
as non-terminals of the GP core """
import __main__ as mod_main
function_set = {}
main_dict = mod_main.__dict__
for obj, addr in main_dict.items():
if obj[0:len(prefix)] == prefix:
try:
op_len = addr.func_code.co_argcount
except:
continue
function_set[obj] = op_len
if len(function_set) <= 0:
Util.raiseException("No function set found using function prefix '%s' !" % prefix, ValueError)
self.setParams(gp_function_set=function_set)
def initialize(self):
""" Initializes the GA Engine. Create and initialize population """
self.internalPop.create(minimax=self.minimax)
self.internalPop.initialize(ga_engine=self)
logging.debug("The GA Engine was initialized !")
def getPopulation(self):
""" Return the internal population of GA Engine
:rtype: the population (:class:`GPopulation.GPopulation`)