Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization methods specifically for RL #1273

Closed
wants to merge 12 commits into from
10 changes: 10 additions & 0 deletions nevergrad/optimization/optimizerlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2059,6 +2059,9 @@ def _internal_tell_candidate(self, candidate: p.Parameter, loss: tp.FloatLoss) -
if self.num_tell < sum_budget:
opt.tell(candidate, loss)

def _internal_provide_recommendation(self) -> tp.ArrayLike:
return self.optimizers[-1]._internal_provide_recommendation() # type: ignore


class Chaining(base.ConfiguredOptimizer):
"""
Expand Down Expand Up @@ -2087,6 +2090,10 @@ def __init__(
GeneticDE = Chaining([RotatedTwoPointsDE, TwoPointsDE], [200]).set_name(
"GeneticDE", register=True
) # Also known as CGDE
MixDeterministicRL = ConfPortfolio(optimizers=[DiagonalCMA, PSO, GeneticDE]).set_name(
"MixDeterministicRL", register=True
)
SpecialRL = Chaining([MixDeterministicRL, TBPSA], ["half"]).set_name("SpecialRL", register=True)
Comment on lines +2093 to +2096
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both?

Suggested change
MixDeterministicRL = ConfPortfolio(optimizers=[DiagonalCMA, PSO, GeneticDE]).set_name(
"MixDeterministicRL", register=True
)
SpecialRL = Chaining([MixDeterministicRL, TBPSA], ["half"]).set_name("SpecialRL", register=True)
SpecialRL = Chaining([ConfPortfolio(optimizers=[DiagonalCMA, PSO, GeneticDE]), TBPSA], ["half"]).set_name("SpecialRL", register=True)

ChainCMAPowell = Chaining([CMA, Powell], ["half"]).set_name("ChainCMAPowell", register=True)
ChainCMAPowell.no_parallelization = True # TODO make this automatic
ChainMetaModelSQP = Chaining([MetaModel, SQP], ["half"]).set_name("ChainMetaModelSQP", register=True)
Expand Down Expand Up @@ -2760,3 +2767,6 @@ def __init__(
base_optimizer: base.OptCls = NGOpt,
) -> None:
super().__init__(_MSR, locals())


NGOptRL = SpecialRL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather we keep one name only if possible, why have two names for now?
As usual, adding more names means more breaking changes down the roads, so I prefer being careful.

3 changes: 3 additions & 0 deletions nevergrad/optimization/recorded_recommendations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ MilliCMA,0.0010125155,-0.0009138806,-0.0010295559,0.0012098418,,,,,,,,,,,,
MiniDE,0.8273276988,-1.2921051963,-0.4797521288,0.2138608624,0.7088815721,0.7346249014,-2.6392592028,-1.0729615222,,,,,,,,
MiniLhsDE,-0.0313128807,0.2738703026,-0.1988242191,0.9942001938,0.7167500893,-0.0350394443,-1.5341684983,-0.3039246928,,,,,,,,
MiniQrDE,-0.2025746195,-0.8778768047,-1.2504657435,0.6265108481,0.4934247309,0.6448108695,-0.3573249779,-1.6986947217,,,,,,,,
MixDeterministicRL,-0.3375952501,-0.585268278,-0.1149199408,2.2418177944,,,,,,,,,,,,
MixES,1.1400386808,0.3380024444,0.4755144618,2.6390460807,0.6911075733,1.111235567,-0.2576843178,-1.1959512855,,,,,,,,
MultiCMA,1.4855013085,-1.5953064496,-0.7871164493,-0.4908938162,,,,,,,,,,,,
MultiDiscrete,0.0,0.0,0.0,1.095956118,,,,,,,,,,,,
Expand Down Expand Up @@ -200,6 +201,8 @@ ScrHaltonSearchPlusMiddlePoint,-1.1503493804,1.2206403488,-0.8416212336,1.067570
ScrHammersleySearch,1.3829941271,-0.318639364,-1.2206403488,1.7506860713,,,,,,,,,,,,
ScrHammersleySearchPlusMiddlePoint,-1.2815515655,0.0,0.4307272993,0.8416212336,,,,,,,,,,,,
Shiwa,0.0,-0.3451057176,-0.1327329683,1.9291307781,,,,,,,,,,,,
SpecialRL,-0.3375952501,-0.585268278,-0.1149199408,2.2418177944,,,,,,,,,,,,
NGOptRL,-0.3375952501,-0.585268278,-0.1149199408,2.2418177944,,,,,,,,,,,,
SparseDiscreteOnePlusOne,0.7531428339,0.0,0.0,0.0,,,,,,,,,,,,
SparseDoubleFastGADiscreteOnePlusOne,0.0,0.0,0.0,0.0942747145,,,,,,,,,,,,
StupidRandom,-1.1543602352,-2.2133334794,-1.6817565104,-1.7880942511,,,,,,,,,,,,
Expand Down