Skip to main content

Thinking Processes

This Python package helps you to draw diagrams used in the Thinking Processes from the Theory of Constraints. For more information about the Thinking Processes, visit https://en.wikipedia.org/wiki/Thinking_processes_(theory_of_constraints). See below for different kinds of diagrams, which you can create using this diagram-as-code package.

Instead of writing code, you can alternatively use the web interface under https://boriswiegand.github.io/Thinking-Processes/ui/.

Prerequisites

  • Python 3.11+

  • Ensure Graphviz is installed and available in your PATH.

Installing

pip install thinking-processes

Current Reality Tree

In this example, we find root causes for undesired effects by drawing a Current Reality Tree:

from thinking_processes import CurrentRealityTree

crt = CurrentRealityTree()
        
engine_not_start = crt.add_node("Car's engine will not start")
engine_needs_fuel = crt.add_node('Engine needs fuel in order to run')
no_fuel_to_engine = crt.add_node('Fuel is not getting to the engine')
water_in_fuel_line = crt.add_node('There is water in the fuel line')
crt.add_causal_relation([engine_needs_fuel, no_fuel_to_engine], engine_not_start)
crt.add_causal_relation([water_in_fuel_line], no_fuel_to_engine)

air_conditioning_not_working = crt.add_node('Air conditioning is not working')
air_not_circulating = crt.add_node('Air is not able to circulate')
air_intake_full_of_water = crt.add_node('The air intake is full of water')
crt.add_causal_relation([air_not_circulating], air_conditioning_not_working)
crt.add_causal_relation([air_intake_full_of_water], air_not_circulating)

radio_distorted = crt.add_node('Radio sounds distorted')
speakers_obstructed = crt.add_node('The speakers are obstructed')
speakers_underwater = crt.add_node('The speakers are underwater')
crt.add_causal_relation([speakers_obstructed], radio_distorted)
crt.add_causal_relation([speakers_underwater], speakers_obstructed)

car_in_pool = crt.add_node('The car is in the swimming pool')
crt.add_causal_relation([car_in_pool], speakers_underwater)
crt.add_causal_relation([car_in_pool], air_intake_full_of_water)
crt.add_causal_relation([car_in_pool], water_in_fuel_line)

handbreak_faulty = crt.add_node('The handbreak is faulty')
handbreak_stops_car = crt.add_node('The handbreak stops the car from rolling into the swimming pool')
crt.add_causal_relation([handbreak_faulty, handbreak_stops_car], car_in_pool)

crt.plot(view=True, filepath='crt.png')

The resulting tree looks like this:

Current Reality Tree

To save some effort in typing, you can create the same diagram using a string representation of the tree:

from thinking_processes import CurrentRealityTree
crt = CurrentRealityTree.from_string("""
1: Car's engine will not start
2: Engine needs fuel in order to run
3: Fuel is not getting to the engine
4: There is water in the fuel line
5: Air conditioning is not working
6: Air is not able to circulate
7: The air intake is full of water
8: Radio sounds distorted
9: The speakers are obstructed
10: The speakers are underwater
11: The car is in the swimming pool
12: The handbreak is faulty
13: The handbreak stops the car\nfrom rolling into the swimming pool

2,3 -> 1
4 -> 3
6 => 5
7 -> 6
9 -> 8
10 -> 9
10 <= 11 
11 <- 12 13
11 -> 7
11 -> 4
""")

Evaporating Cloud (Conflict Resolution Diagram)

In this example, we resolve a conflict by identifying wrong assumptions behind the conflict:

from thinking_processes import EvaporatingCloud

ec = EvaporatingCloud(
    objective='Reduce cost per unit',
    need_a='Reduce setup cost per unit',
    need_b='Reduce carrying cost per unit',
    conflict_part_a='Run larger batches',
    conflict_part_b='Run smaller batches'
)

ec.add_assumption_on_the_conflict('small is the opposite of large', is_true=True)
ec.add_assumption_on_the_conflict('there is only one meaning to the word "batch"', is_true=False)
ec.add_assumption_on_need_a("setup cost is fixed and can't be reduced")
ec.add_assumption_on_need_a("the machine being set up is a bottleneck with no spare capacity")
ec.add_assumption_on_need_b("smaller batches reduce carrying cost")

ec.plot(view=True, filepath='ec.png')

The resulting diagram looks like this:

Evaporating Cloud

Prerequisite Tree

In this example, we identify and overcome obstacles to achieve a goal:

from thinking_processes import PrerequisiteTree
prt = PrerequisiteTree(objective='Repair the handbrake')
        
missing_knowledge = prt.add_obstacle('Cannot repair the handbrake')

learn = missing_knowledge.add_solution('Learn to repair the handbrake')
learn.add_obstacle('No time to learn')

let_repair = missing_knowledge.add_solution('Let someone else repair the handbrake')
no_money = let_repair.add_obstacle('No money to let repair the handbrake')
no_money.add_solution('Save money')

prt.plot(view=True, filepath='prt.png')

The resulting diagram looks like this:

Prerequisite Tree

Alternatively, you can create the same diagram using a string representation of the tree:

from thinking_processes import PrerequisiteTree
prt = PrerequisiteTree.from_string("""
Repair the handbreak
    Cannot repair the handbreak
        Learn to repair the handbreak
            No time to learn
        Let someone repair the handbreak
            No money
                Save money
""")

Development

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Running the tests

All tests in the "tests" directory are based on the unittest package.

Deployment

rm -R dist thinking_processes.egg-info
python -m build && twine upload --skip-existing --verbose dist/*

You should also create a tag for the current version

git tag -a [version] -m "describe what has changed"
git push --tags

Versioning

We use SemVer for versioning.

Authors

If you have any questions, feel free to ask one of our authors:

Metadata

Release files for thinking-processes 1.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for thinking-processes 1.8.2
File Size Uploaded
thinking_processes-1.8.2.tar.gz 53.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for thinking-processes 1.8.2
File Interpreter ABI Platform
thinking_processes-1.8.2-py3-none-any.whl Python 3 none any Details

Total release size: 103.2 kB

Release files / thinking_processes-1.8.2.tar.gz

Download URL thinking_processes-1.8.2.tar.gz
Size 53.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c6b078d757a676a3c7530c500e2b14979cd52985e4018bac8747b7df7502fdfb
BLAKE2b-256 checksum
How to use checksums
14b23f08190111bdc5f83f0f5b40ebcdafbe9a4ade7512e6e2ceb2952b548622
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / thinking_processes-1.8.2-py3-none-any.whl

Download URL thinking_processes-1.8.2-py3-none-any.whl
Size 49.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cf00320b744d37685bc4f4b8d550236ddad984008e8a83bfd85a6fe49f864ce
BLAKE2b-256 checksum
How to use checksums
57cc0c8a6ecabc5382c21d538b170eccf5ecb6f0958c3f6297fd0ac12396d9a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

1.8.3

2 release files

This release

1.8.2 This release

2 release files

1.8.1

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page