def optimize(self, cid, other_champion_stats): champion = Champion.objects(champion_id=cid).get() self.input_array[0] = cid self.input_array[1:7] = np.array(champion.class_data) self.input_array[7:self.start_ind] = np.array(other_champion_stats) x0 = [random.choice(self.item_ids) for x in range(12)] ret = basinhopping(self.objective_function, x0, take_step=self.TakeStep(self.item_ids, self.stepsize), minimizer_kwargs=self.minimizer_kwargs, niter=100, stepsize=100, T=10.0) return ret
def optimize(self, cid, other_champion_stats): champion = Champion.objects(champion_id=cid).get() self.input_array[0] = cid self.input_array[1:7] = np.array(champion.class_data) self.input_array[7:self.start_ind] = np.array(other_champion_stats) x0 = [random.choice(self.item_ids) for x in range(12)] ret = basinhopping( self.objective_function, x0, take_step=self.TakeStep(self.item_ids, self.stepsize), minimizer_kwargs=self.minimizer_kwargs, niter=100, stepsize=100, T=10.0 ) return ret
def _load_champions(self, w): static_champ_list = w.static_get_champion_list(champ_data='tags') for cname in static_champ_list['data']: champion = Champion.from_dict(static_champ_list['data'][cname]) champion.save()