class documentation
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 |
lower and 1 - upper bound for mean, avoid getting stuck "forever" |
| Instance Variable | mean |
Undocumented |
| Instance Variable | stop |
Undocumented |
| Property | result |
for the time being result is the best seen solution |