Created
January 27, 2020 15:29
-
-
Save sile/a8c13f068273d616a6c45ed0bb93e299 to your computer and use it in GitHub Desktop.
Kurobako blog: sa.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A solver implementation based on Simulated Annealing algorithm. | |
from kurobako import solver | |
from kurobako.solver.optuna import OptunaSolverFactory | |
import optuna | |
class SimulatedAnnealingSampler(optuna.BaseSampler): | |
# Please refer to | |
# https://github.com/optuna/optuna/blob/v1.0.0/examples/samplers/simulated_annealing_sampler.py | |
# for the implementation. | |
... | |
def create_study(seed): | |
sampler = SimulatedAnnealingSampler(seed=seed) | |
return optuna.create_study(sampler=sampler) | |
if __name__ == ‘__main__’: | |
factory = OptunaSolverFactory(create_study) | |
runner = solver.SolverRunner(factory) | |
runner.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment