def _get_algorithm_order(self): """ Return a list of algorithms in the order determined by the user. If 'filter_algorithm' is given, algorithms are sorted in that order. Otherwise, they are sorted alphabetically. You can use the order of algorithms in your own custom report subclasses by accessing self.algorithms which is calculated in self._scan_planning_data. """ all_algos = {run["algorithm"] for run in self.props.values()} if self.filter_algorithm: # Other filters may have changed the set of available algorithms by either # removing all runs for one algorithm or changing run['algorithm'] for a run. # Maintain the original order of algorithms and only keep algorithms that # still have runs after filtering. Then add all new algorithms # sorted naturally at the end. algo_order = [ c for c in self.filter_algorithm if c in all_algos ] + tools.natural_sort(all_algos - set(self.filter_algorithm)) else: algo_order = tools.natural_sort(all_algos) return algo_order
def __init__(self, benchmarks_dir, domain): self.domain = domain self.directory = os.path.join(benchmarks_dir, domain) problems = os.listdir(self.directory) problems = tools.natural_sort([p for p in problems if 'domain' not in p and not p.startswith('.')]) tools.natural_sort(problems) self.problems = [Problem(benchmarks_dir, domain, problem) for problem in problems]
def get_text(self): """ We do not need any markup processing or loop over attributes here, so the get_text() method is implemented right here. """ tasks = ['%s:%s' % task for task in self.problems] lines = [' "%s",' % task for task in tools.natural_sort(tasks)] return 'def suite():\n return [\n%s\n]\n' % '\n'.join(lines)
def __init__(self, benchmarks_dir, domain): self.domain = domain directory = os.path.join(benchmarks_dir, domain) problem_files = tools.natural_sort([ p for p in os.listdir(directory) if "domain" not in p and not p.endswith(".py") ]) self.problems = [ Problem(domain, problem, benchmarks_dir=benchmarks_dir) for problem in problem_files ]
def __init__(self, benchmarks_dir, domain): self.domain = domain directory = os.path.join(benchmarks_dir, domain) problem_files = tools.natural_sort( [ p for p in os.listdir(directory) if "domain" not in p and p.endswith((".pddl", ".sas")) ] ) self.problems = [ get_problem(benchmarks_dir, domain, problem) for problem in problem_files ]
def col_names(self): """Return all data column names in sorted order.""" if self._cols: return self._cols col_names = set() for row in self.values(): col_names |= set(row.keys()) self._cols = [] if self.column_order: # First use all elements for which we know an order. # All remaining elements will be sorted alphabetically. self._cols = [c for c in self.column_order if c in col_names] col_names -= set(self._cols) self._cols += tools.natural_sort(col_names) return self._cols
def _get_config_order(self): """ Returns a list of configs in the order that was determined by the user. You can use the order of configs in your own custom report subclasses by accessing self.configs which is calculated in self._scan_planning_data. In order of decreasing priority these are the three ways to determine the order: 1. A filter for 'config' is given with filter_config. 2. A filter for 'config_nick' is given with filter_config_nick. In this case all configs that are represented by the same nick are sorted alphabetically. 3. If no explicit order is given, the configs will be sorted alphabetically. """ all_configs = set() config_nicks_to_config = defaultdict(set) for run in self.props.values(): config = run['config'] all_configs.add(config) # For preprocess experiments config_nick is not set. nick = run.get('config_nick', config) config_nicks_to_config[nick].add(config) if self.filter_config_nick and not self.filter_config: for nick in self.filter_config_nick: self.filter_config += sorted(config_nicks_to_config[nick]) if self.filter_config: # Other filters may have changed the set of available configs by either # removing all runs from one config or changing the run['config'] for a run. # Maintain the original order of configs and only keep configs that still # have available runs after filtering. Then add all new configs sorted # naturally at the end. config_order = [c for c in self.filter_config if c in all_configs] config_order += list(tools.natural_sort(all_configs - set(self.filter_config))) else: config_order = list(tools.natural_sort(all_configs)) return config_order
def row_names(self): """Return all data row names in sorted order.""" return self.row_order or tools.natural_sort(self.keys())
def row_names(self): """Return all data row names in sorted order.""" return tools.natural_sort(self.keys())