Hi @alex
I want to run batch optimization. The functionality of batch optimization is currently not working. Please find the relevant code which is simply finding a minima of Rosenbrock test function, batch_size of anything >1 causes FW to go to sleep loop:
from fireworks import FireTaskBase, Firework, FWAction, LaunchPad, Workflow
from fireworks.core.rocket_launcher import rapidfire
from fireworks.utilities.fw_utilities import explicit_serialize
from rocketsled import MissionControl, OptTask
import numpy as np
# Setting up the FireWorks LaunchPad
launchpad = LaunchPad(name="rsled")
opt_label = "opt_default"
db_info = {"launchpad": launchpad, "opt_label": opt_label}
x_dim = [(-5.0, 5.0), (-5.0, 5.0)]
@explicit_serialize
class ROSENBROCKTask(FireTaskBase):
_fw_name = "ROSENBROCKTask"
def run_task(self, fw_spec):
x = fw_spec["_x"]
y = (1 - x[0])** 2 + 100*(x[1] - x[0] ** 2) ** 2
return FWAction(update_spec={"_y": y})
def wf_creator_ROSENBROCK(x):
spec = {"_x": x}
# ObjectiveFuncTask writes _y field to the spec internally.
firework1 = Firework([ROSENBROCKTask(), OptTask(**db_info)], spec=spec)
return Workflow([firework1])
def execute(n_evaluation, predictor_Selected, acquisition_function):
mc = MissionControl(**db_info)
launchpad.reset(password=date_, require_password=True)
mc.reset(hard=True)
mc.configure(wf_creator=wf_creator_ROSENBROCK, dimensions=x_dim, acq=acquisition_function,
predictor=predictor_Selected,batch_size=2)
launchpad.add_wf(wf_creator_ROSENBROCK([a, b]))
rapidfire(launchpad, nlaunches=n_evaluation, sleep_time=0)
mc.results()
if __name__ == "__main__":
date_='2021-11-28'
a = np.random.uniform(-5,5)
b = np.random.uniform(-5,5)
predictor_Selected = 'GaussianProcessRegressor'
acquisition_function = 'lcb'
n_evaluation = 100
execute(n_evaluation, predictor_Selected, acquisition_function)
My objective is to use the batch optimization to run several parallel experiments based on suggestions and implement other heuristic such as Krigging Believe and compare the results.
Best,
Abdul Wahab