You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To implement CMA-ES variants, it is better to provide a protocol for optimizer API (See PEP 544 or Python docs for details).
Probably, the protocol will be like this:
importnumpyasnpfromtypingimportList, Optional, Tupletry:
fromtypingimportProtocolexceptImportError:
fromtyping_extensionsimportProtocolclassOptimizer(Protocol):
@propertydefdim(self) ->int:
"""A number of dimensions"""@propertydefgeneration(self) ->int:
"""Generation number which is monotonically incremented when multi-variate gaussian distribution is updated."""@propertydefpopulation_size(self) ->int:
"""A population size"""defask(self) ->np.ndarray:
"""Sample a parameter"""deftell(self, solutions: List[Tuple[np.ndarray, float]]) ->None:
"""Tell evaluation values"""defset_bounds(self, bounds: Optional[np.ndarray]) ->None:
"""Update boundary constraints"""
The text was updated successfully, but these errors were encountered:
To implement CMA-ES variants, it is better to provide a protocol for optimizer API (See PEP 544 or Python docs for details).
Probably, the protocol will be like this:
The text was updated successfully, but these errors were encountered: