Complex problems are often difficult to solve because it is hard to see which path offers the most logical breakdown of steps. It is difficult to know which sequence of actions actually addresses the core parts of a goal.
It breaks a large goal into a hierarchy of smaller tasks and ranks different ways to solve it based on how well those paths cover the necessary steps. It provides a score for each path to show which one is the most structurally diverse.
It helps identify the most comprehensive way to break down a complex project by looking at the structure of the tasks involved.
It was run inside an isolated container with no network access. This is the exact command and the real output it produced — captured process output, not written by a model.
$ python3 ranker.py Ranked paths by entropy and decomposition: Path: M -> N -> O -> P -> Q, Score: 11.3966 Path: X -> Y -> Z -> W, Score: 7.8838 Path: A -> B -> C, Score: 4.7129
A screenshot of that run.
A clean run proves this does what is shown above, in a CPU-only sandbox. It is a small research demo — not a production tool, and nothing here was published anywhere.
All of it — 65 lines, one file, standard library only.
import math
from collections import Counter
def recursive_decomposition(path):
if len(path) == 0:
return []
if len(path) == 1:
return [path]
head = path[:1]
tail = path[1:]
return [head] + recursive_decomposition(tail)
def calculate_entropy(elements):
if not elements:
return 0.0
counts = Counter(elements)
total = sum(counts.values())
entropy = -sum((count / total) * math.log2(count / total) for count in counts.values())
return entropy
def path_entropy(path):
n = len(path)
sub_paths = []
for i in range(n):
for j in range(i+1, n+1):
sub_paths.append(tuple(path[i:j]))
decomposition = []
for sub in sub_paths:
decomposition.extend(recursive_decomposition(sub))
structure_elements = [tuple(''.join(map(str, s))) for s in decomposition]
return calculate_entropy(structure_elements)
def get_transitions(path):
return [(path[i], path[i+1]) for i in range(len(path)-1)]
def symbolic_path_entropy_ranker(paths):
ranked_paths = []
for path in paths:
original_entropy = path_entropy(path)
transitions = get_transitions(path)
transition_entropy = calculate_entropy(transitions)
depth = len(recursive_decomposition(path))
# Original Ranking Score (backward compatible)
original_score = original_entropy * depth
# Complexity-Weighted Score with transition entropy
complexity_weighted_score = (original_entropy + transition_entropy) * depth
ranked_paths.append((path, original_score, complexity_weighted_score, original_entropy, transition_entropy))
# Sort by original score for backward compatibility
ranked_paths.sort(key=lambda x: x[1], reverse=True)
return ranked_paths
if __name__ == "__main__":
paths = [
['A', 'B', 'C'],
['X', 'Y', 'Z', 'W'],
['M', 'N', 'O', 'P', 'Q']
]
ranked = symbolic_path_entropy_ranker(paths)
print("Ranked paths by Complexity-Weighted score (includes node transitions entropy):")
for path, original_score, complexity_weighted_score, orig_entropy, trans_entropy in ranked:
print(f"Path: {' -> '.join(path)}, Total Score: {complexity_weighted_score:.4f}, Original Entropy: {orig_entropy:.4f}, Transition Entropy: {trans_entropy:.4f}")