def _exampleRuns(): fid = 1 ndim = 10 iids = range(Config.ES_num_runs) print("Mirrored vs Mirrored-pairwise") rep = ensureFullLengthRepresentation(getBitString({'mirrored': True})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( getBitString({ 'mirrored': True, 'selection': 'pairwise' })) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) print("Regular vs Active") rep = ensureFullLengthRepresentation(getBitString({'active': False})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation(getBitString({'active': True})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) print("No restart vs local restart") rep = ensureFullLengthRepresentation(getBitString({'ipop': None})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation(getBitString({'ipop': True})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation(getBitString({'ipop': 'IPOP'})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation(getBitString({'ipop': 'BIPOP'})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim)
def test_unknown_key(self): self.assertListEqual( getBitString({ 'foo': 1, 'bar': 2, 'spam': 3, 'eggs': 4 }), [0] * self.length)
def _problemCases(): fid = 1 ndim = 10 iids = range(Config.ES_num_runs) # Known problems print("Combinations known to cause problems:") rep = ensureFullLengthRepresentation(getBitString({'sequential': True})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation(getBitString({'tpa': True})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( getBitString({'selection': 'pairwise'})) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( getBitString({ 'tpa': True, 'selection': 'pairwise' })) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) # these are the actual failures rep = ensureFullLengthRepresentation( getBitString({ 'sequential': True, 'selection': 'pairwise' })) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( getBitString({ 'sequential': True, 'tpa': True, 'selection': 'pairwise' })) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 113, 0.18770573922911427]) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 107, 0.37768142336353183]) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( [0, 1, 1, 0, 1, 0, 1, 1, 0, 2, 2, None, None]) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 27, 0.9383818903266666]) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim) rep = ensureFullLengthRepresentation( [0, 0, 1, 1, 0, 0, 1, 0, 1, 2, 2, 3, 0.923162952008686]) print(getPrintName(getOpts(rep[:-2]))) evaluateCustomizedESs(rep, iids=iids, fid=fid, ndim=ndim)
def test_base_case(self): self.assertListEqual(getBitString(self.default), [0] * self.length)