def __init__(self, space: List[Dict]=None, name: str='Default Tune Experiment', max_concurrent: int=1, connection: Optional[Connection]=None, experiment_id: Optional[str]=None, observation_budget: Optional[int]=None, project: Optional[str]=None, metric: Union[(None, str, List[str])]='episode_reward_mean', mode: Union[(None, str, List[str])]='max', points_to_evaluate: Optional[List[Dict]]=None, **kwargs):
    assert ((experiment_id is None) ^ (space is None)), 'space xor experiment_id must be set'
    assert ((type(max_concurrent) is int) and (max_concurrent > 0))
    if (connection is not None):
        self.conn = connection
    else:
        assert (sgo is not None), 'SigOpt must be installed!\n                You can install SigOpt with the command:\n                `pip install -U sigopt`.'
        assert ('SIGOPT_KEY' in os.environ), 'SigOpt API key must be stored as environ variable at SIGOPT_KEY'
        self.conn = sgo.Connection(client_token=os.environ['SIGOPT_KEY'])
    self._max_concurrent = max_concurrent
    if isinstance(metric, str):
        metric = [metric]
        mode = [mode]
    self._metric = metric
    self._live_trial_mapping = {}
    if (experiment_id is None):
        sigopt_params = dict(name=name, parameters=space, parallel_bandwidth=self._max_concurrent)
        if (observation_budget is not None):
            sigopt_params['observation_budget'] = observation_budget
        if (project is not None):
            sigopt_params['project'] = project
        if ((len(metric) > 1) and (observation_budget is None)):
            raise ValueError('observation_budget is required for anexperiment with more than one optimized metric')
        sigopt_params['metrics'] = self.serialize_metric(metric, mode)
        self.experiment = self.conn.experiments().create(**sigopt_params)
    else:
        self.experiment = self.conn.experiments(experiment_id).fetch()
    self._points_to_evaluate = points_to_evaluate
    super(SigOptSearch, self).__init__(metric=metric, mode=mode, **kwargs)
def __init__(self, space: List[Dict]=None, name: str='Default Tune Experiment', max_concurrent: int=1, connection: Optional[Connection]=None, experiment_id: Optional[str]=None, observation_budget: Optional[int]=None, project: Optional[str]=None, metric: Union[(None, str, List[str])]='episode_reward_mean', mode: Union[(None, str, List[str])]='max', points_to_evaluate: Optional[List[Dict]]=None, **kwargs):
    assert ((experiment_id is None) ^ (space is None)), 'space xor experiment_id must be set'
    assert ((type(max_concurrent) is int) and (max_concurrent > 0))
    if (connection is not None):
        self.conn = connection
    else:
        assert (sgo is not None), 'SigOpt must be installed!\n                You can install SigOpt with the command:\n                `pip install -U sigopt`.'
        assert ('SIGOPT_KEY' in os.environ), 'SigOpt API key must be stored as environ variable at SIGOPT_KEY'
        self.conn = sgo.Connection(client_token=os.environ['SIGOPT_KEY'])
    self._max_concurrent = max_concurrent
    if isinstance(metric, str):
        metric = [metric]
        mode = [mode]
    self._metric = metric
    self._live_trial_mapping = {}
    if (experiment_id is None):
        sigopt_params = dict(name=name, parameters=space, parallel_bandwidth=self._max_concurrent)
        if (observation_budget is not None):
            sigopt_params['observation_budget'] = observation_budget
        if (project is not None):
            sigopt_params['project'] = project
        if ((len(metric) > 1) and (observation_budget is None)):
            raise ValueError('observation_budget is required for anexperiment with more than one optimized metric')
        sigopt_params['metrics'] = self.serialize_metric(metric, mode)
        self.experiment = self.conn.experiments().create(**sigopt_params)
    else:
        self.experiment = self.conn.experiments(experiment_id).fetch()
    self._points_to_evaluate = points_to_evaluate
    super(SigOptSearch, self).__init__(metric=metric, mode=mode, **kwargs)