def get_solution(self, num_solutions):
    LOG.debug('search start for max {} solutions'.format(num_solutions))
    for rk in self.requests:
        request = self.requests[rk]
        LOG.debug('--- request = {}'.format(rk))
        decision_list = list()
        LOG.debug('1. sort demands')
        demand_list = self._sort_demands(request)
        for d in demand_list:
            LOG.debug('    demand = {}'.format(d.name))
        LOG.debug('2. search')
        rand_counter = 10
        while ((num_solutions == 'all') or (num_solutions > 0)):
            LOG.debug('searching for the solution {}'.format((len(decision_list) + 1)))
            st = time.time()
            _copy_demand_list = copy.deepcopy(demand_list)
            if (not request.objective.goal):
                LOG.debug('No objective function is provided. Random pick algorithm is used')
                self.search = random_pick.RandomPick(self.conf)
                best_path = self.search.search(demand_list, request)
            else:
                LOG.debug('Fit first algorithm is used')
                self.search = fit_first.FitFirst(self.conf)
                best_path = self.search.search(demand_list, request.objective, request)
            LOG.debug('search delay = {} sec'.format((time.time() - st)))
            demand_list = copy.deepcopy(_copy_demand_list)
            if (best_path is not None):
                self.search.print_decisions(best_path)
                rand_counter = 10
            elif ((not request.objective.goal) and (rand_counter > 0) and self._has_candidates(request)):
                rand_counter -= 1
                LOG.debug('Incomplete random solution - repeat {}'.format(rand_counter))
                continue
            else:
                LOG.debug('no solution found')
                break
            decision_list.append(best_path.decisions)
            self._remove_unique_candidate(request, best_path, demand_list)
            if (num_solutions != 'all'):
                num_solutions -= 1
        self.search.triageSolver.getSolution(decision_list)
        return decision_list
def get_solution(self, num_solutions):
    LOG.debug('search start for max {} solutions'.format(num_solutions))
    for rk in self.requests:
        request = self.requests[rk]
        LOG.debug('--- request = {}'.format(rk))
        decision_list = list()
        LOG.debug('1. sort demands')
        demand_list = self._sort_demands(request)
        for d in demand_list:
            LOG.debug('    demand = {}'.format(d.name))
        LOG.debug('2. search')
        rand_counter = 10
        while ((num_solutions == 'all') or (num_solutions > 0)):
            LOG.debug('searching for the solution {}'.format((len(decision_list) + 1)))
            st = time.time()
            _copy_demand_list = copy.deepcopy(demand_list)
            if (not request.objective.goal):
                LOG.debug('No objective function is provided. Random pick algorithm is used')
                self.search = random_pick.RandomPick(self.conf)
                best_path = self.search.search(demand_list, request)
            else:
                LOG.debug('Fit first algorithm is used')
                self.search = fit_first.FitFirst(self.conf)
                best_path = self.search.search(demand_list, request.objective, request)
            LOG.debug('search delay = {} sec'.format((time.time() - st)))
            demand_list = copy.deepcopy(_copy_demand_list)
            if (best_path is not None):
                self.search.print_decisions(best_path)
                rand_counter = 10
            elif ((not request.objective.goal) and (rand_counter > 0) and self._has_candidates(request)):
                rand_counter -= 1
                LOG.debug('Incomplete random solution - repeat {}'.format(rand_counter))
                continue
            else:
                LOG.debug('no solution found')
                break
            decision_list.append(best_path.decisions)
            self._remove_unique_candidate(request, best_path, demand_list)
            if (num_solutions != 'all'):
                num_solutions -= 1
        self.search.triageSolver.getSolution(decision_list)
        return decision_list