class documentation

class CompactGA(object):

Constructor: CompactGA(mean_)

View In Hierarchy

Randomized search on the binary domain {0,1}^n.

cGA samples two different solutions per iteration.

Minimal example:

dimension = 20
opt = CompactGA(dimension * [0.5])  # initialise in domain middle
while opt.best.f > 0 and not opt.stop():
    opt.optimize(sum, 1)
print("%d: fbest=%f" % (opt.evaluation, opt.best.f))

finds argmin_{x in {0, 1}**20} sum(x) in opt.result.

Details: due to the incrememental update, cGA is expected to show inferior scaling with dimension on LeadingOnes and/or BinVal.

Reference: Harik et al 1999.

Method __init__ takes as input the initial vector of probabilities to sample 1 vs 0.
Method ask return two candidate solutions
Method optimize Undocumented
Method stop dictionary containing satisfied termination conditions
Method tell update self.mean
Instance Variable best Undocumented
Instance Variable dimension Undocumented
Instance Variable eta Undocumented
Instance Variable evaluation Undocumented
Instance Variable fcurrent Undocumented
Instance Variable lower_p lower and 1 - upper bound for mean, avoid getting stuck "forever"
Instance Variable mean Undocumented
Instance Variable stop_stagnation_evals Undocumented
Property result for the time being result is the best seen solution
def __init__(self, mean_):

takes as input the initial vector of probabilities to sample 1 vs 0.

The vector length defines the dimension. Initial values of the probability vector, which is also the distribution mean, are usually chosen to be 0.5.

def ask(self):

return two candidate solutions

def optimize(self, fun, iterations):

Undocumented

def stop(self):

dictionary containing satisfied termination conditions

def tell(self, solutions, fitness_values):

update self.mean

best =

Undocumented

dimension =

Undocumented

eta =

Undocumented

evaluation: int =

Undocumented

fcurrent =

Undocumented

lower_p =

lower and 1 - upper bound for mean, avoid getting stuck "forever"

mean =

Undocumented

stop_stagnation_evals =

Undocumented

@property
result =

for the time being result is the best seen solution