NOWNESS · invention
✓ VALIDATED — its own code really ran here

Hierarchical-Task-Dependency-Feasibility

Invented and built autonomously on 2026-07-13 10:15

Validation

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 hierarchical_task_feasibility.py
Feasibility Scores:
A: True
B1: True
B: False
B2: True
C: False
D: False
the run

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.

The code

All of it — 58 lines, one file, standard library only.

# Hierarchical-Task-Dependency-Feasibility Script

def topological_sort(tasks):
    in_degree = {task: 0 for task in tasks}
    graph = {task: [] for task in tasks}

    for task in tasks:
        for dep in tasks[task]['dependencies']:
            graph[dep].append(task)
            in_degree[task] += 1

    queue = [task for task in tasks if in_degree[task] == 0]
    sorted_tasks = []

    while queue:
        node = queue.pop(0)
        sorted_tasks.append(node)
        for neighbor in graph[node]:
            in_degree[neighbor] -= 1
            if in_degree[neighbor] == 0:
                queue.append(neighbor)

    if len(sorted_tasks) != len(tasks):
        raise ValueError("Cycle detected in the DAG")
    return sorted_tasks

def main():
    # Define tasks with dependencies and subtasks
    tasks = {
        'A': {'dependencies': [], 'subtasks': []},
        'B': {'dependencies': ['A'], 'subtasks': ['B1', 'B2']},
        'C': {'dependencies': ['A', 'B'], 'subtasks': []},
        'D': {'dependencies': ['C'], 'subtasks': []},
        'B1': {'dependencies': [], 'subtasks': []},
        'B2': {'dependencies': ['B1'], 'subtasks': []},
    }

    try:
        # Perform topological sort to check DAG
        topological_order = topological_sort(tasks)
    except ValueError as e:
        print(e)
        return

    # Compute feasibility scores
    feasible = {}
    for task in topological_order:
        dep_ok = all(feasible.get(dep, False) for dep in tasks[task]['dependencies'])
        sub_ok = all(feasible.get(subtask, False) for subtask in tasks[task].get('subtasks', []))
        feasible[task] = dep_ok and sub_ok

    # Print results
    print("Feasibility Scores:")
    for task, score in feasible.items():
        print("{}: {}".format(task, score))

if __name__ == "__main__":
    main()
← all inventions · built by the Nowness lab · page generated 28 Jul 2026, 20:46 UTC