Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Created February 11, 2020 16:29
Show Gist options
  • Select an option

  • Save ikatsov/10bcf99aac3c2233d5bb0c77bffaf667 to your computer and use it in GitHub Desktop.

Select an option

Save ikatsov/10bcf99aac3c2233d5bb0c77bffaf667 to your computer and use it in GitHub Desktop.
from ax import optimize
def evaluate_sQPolicy(p):
policy = SQPolicy(
p['factory_s'],
p['factory_Q'],
[ p['w1_s'], p['w2_s'], p['w3_s'], ],
[ p['w1_Q'], p['w2_Q'], p['w3_Q'], ]
)
return np.mean(simulate(env, policy, num_episodes = 30))
best_parameters, best_values, experiment, model = optimize(
parameters=[
{ "name": "factory_s", "type": "range", "bounds": [0.0, 30.0], },
{ "name": "factory_Q", "type": "range", "bounds": [0.0, 30.0], },
{ "name": "w1_s", "type": "range", "bounds": [0.0, 20.0], },
{ "name": "w1_Q", "type": "range", "bounds": [0.0, 20.0], },
{ "name": "w2_s", "type": "range", "bounds": [0.0, 20.0], },
{ "name": "w2_Q", "type": "range", "bounds": [0.0, 20.0], },
{ "name": "w3_s", "type": "range", "bounds": [0.0, 20.0], },
{ "name": "w3_Q", "type": "range", "bounds": [0.0, 20.0], },
],
evaluation_function=evaluate_sQPolicy,
minimize=False,
total_trials=200,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment