available_gpus = gp.getAvailable(limit=5) #try: #available_gpus.remove(0)#CHRIS gpu 0 and 5 are differen gpu types on duranium since they are faster, timing will be unreliable, so remove them from list #except: #pass #try: #available_gpus.remove(5) #except: #pass print(available_gpus) n_job = max(min(5, len(available_gpus)), 1) # use random forest as the surrogate model #CHRIS two surrogate models are needed model = RandomForest(levels=search_space.levels, n_estimators=100) opt = mipego(search_space, objective, model, ftarget=None, minimize=True, noisy=False, max_eval=None, max_iter=n_step, infill='MGFI', n_init_sample=n_init_sample, n_point=1, n_job=n_job, n_restart=None, max_infill_eval=None, wait_iter=3,
eval_n += 1 x_r, x_i, x_d = np.array([x['C_0'], x['C_1']]), x['I'], x['N'] if x_d == 'OK': tmp = 0 else: tmp = 1 return np.sum(x_r**2.) + abs(x_i - 10) / 123. + tmp * 2. C = ContinuousSpace([-5, 5], 'C') * 2 I = OrdinalSpace([-100, 100], 'I') N = NominalSpace(['OK', 'A', 'B', 'C', 'D', 'E'], 'N') search_space = C * I * N model = RandomForest(levels=search_space.levels) # model = RrandomForest(levels=search_space.levels, seed=1, max_features='sqrt') opt = mipego( search_space, obj_func, model, max_iter=n_step, random_seed=None, n_init_sample=n_init_sample, minimize=True, log_file="test.log", verbose=True, optimizer='MIES', infill='EI', available_gpus=[1, 2],