2. The problem
● Create installation plan for customer
requesting Cable TV with Internet
● Order contains:
– Technology (optic, regular)
– TV/Internet/Phone
– Address
– Etc...
3. The solution
● Backward composition of directed acyclic
graph
● Root node is customer order
● Each other node is installation instruction
● Edge means that parent can't be executed
before child
5. Composition
● Backward composition
● Each node is of certain type and can connect
to only certain nodes
● Nodes types are stored in DB
● Evaluate which nodes can connect to the node
● Node instances are instantiated from node
types in runtime
6. Example #2
● Algorithm:
Incomplete = [order_node]
While not incomplete.is_empty():
for node in incomplete:
node_types = db.find_suitable_node_types(node)
For child_type in node_types:
If child_type.can_expand(node):
child_node = child_type.expand(node)
Incomplete.add(child_node)
If node.is_complete():
Incomplete.remove(node)
8. Example of node
class DslEntryPoint:
def can_expand(node):
return evaluate(this.condition, parent=node)
def expand(parent):
child = new DslEntryPoint(parent.address)
parent.add_child(child)
return child